Re: [PATCH] Rewriting git-repack in C

2013-08-14 Thread Matthieu Moy
Stefan Beller  writes:

> Also I'd like to propose a small technical change:
> I found no easy way to get a subset of files in a specific directory,
> which is very easy in the shell version via * (rm 
> file/in/dir/startswithprefix-*),
> So maybe instead of just prefixing the temporary files such as:
> $PACKDIR/.tmp-$PID-pack-*

If it's just a prefix, you can iterate over the full list of files, and
then use prefixcmp(...) to find the right files. May seem inefficient,
but AFAIK it's how the shell does wildcard expansion.

You should be carefull that if the operation is interrupted, the next
"git gc" must remove all the garbage, so if you change the naming
convention, you must also change the place where the cleanup is done.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[PATCH] Rewriting git-repack in C

2013-08-13 Thread Stefan Beller
Hello,

a few days ago, I asked how I would proceed if I'd want to rewrite git-repack.
The general consensus (Duy, Junio and Matthieu) was to not touch
git-pack-objects, but rather translate the shell version of the git-repack
to C.
I'll send a very rough patch, which still contains 2 todos, so it is not yet
feature complete. I was using the run_command api and the string-list api
a lot.
The following patch is definitle not recommended for a fine review, but
I'd still ask for feedback, whether this seems like the right approach.

Also I'd like to propose a small technical change:
I found no easy way to get a subset of files in a specific directory,
which is very easy in the shell version via * (rm 
file/in/dir/startswithprefix-*),
So maybe instead of just prefixing the temporary files such as:
$PACKDIR/.tmp-$PID-pack-*
we could put all the temporary files in a temporary directory.
This would come handy as there already exists functions to manipulate 
a directory recursively (such as remove_dir_recursively)

That patch requires the patches of jc/parseopt-command-modes

Stefan

Stefan Beller (1):
  repack: rewrite the shell script in C.

 Makefile   |   2 +-
 builtin.h  |   1 +
 builtin/repack.c   | 313 +
 contrib/examples/git-repack.sh | 194 +
 git-repack.sh  | 194 -
 git.c  |   1 +
 6 files changed, 510 insertions(+), 195 deletions(-)
 create mode 100644 builtin/repack.c
 create mode 100755 contrib/examples/git-repack.sh
 delete mode 100755 git-repack.sh

-- 
1.8.4.rc2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html