Signed-off-by: Mike Hommey <mh@glandium.org>
---
git-clone.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)diff --git a/git-clone.sh b/git-clone.sh
index 0ea3c24..57e96ae 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -191,7 +191,9 @@ fi
# it is local
if base=$(get_repo_base "$repo"); then
repo="$base"
- local=yes
+ if type cpio > /dev/null 2>&1; then
+ local=yes
+ fi
fidir="$2"
--
1.5.3.4-
BTW, you have workaround for git-merge also? It uses cpio to save/restore state.
--
Duy
-
Why do people want "workaround"? Is installing cpio such a
hassle?-
Note that to do what git-merge does with cpio, i wonder if it wouldn't
be sensible to use git stash, now.Mike
-
Like this? That's an excellent suggestion.
The patch uses the 'git stash create' which is in 'next'
(jc/stash-create topic).Having said that, the savestate()/restorestate() codepaths are
only relevant to the "try multiple strategies and pick the best
one" feature of git-merge, and that is where cpio is used (and
the patch rewrites it to use stash). I am not sure if anybody
ever used it in practice. I admit I am guilty of inventing it,
but I certainly do not.It might make sense to remove that try-multiple-strategies
feature from git-merge and be done with it. It would certainly
make the eventual rewrite to C much easier.---
git-merge.sh | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)diff --git a/git-merge.sh b/git-merge.sh
index 3a01db0..e8916cc 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -28,20 +28,19 @@ allow_trivial_merge=tdropsave() {
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
- "$GIT_DIR/MERGE_SAVE" || exit 1
+ "$GIT_DIR/MERGE_STASH" || exit 1
}savestate() {
# Stash away any local modifications.
- git diff-index -z --name-only $head |
- cpio -0 -o >"$GIT_DIR/MERGE_SAVE"
+ git stash create >"$GIT_DIR/MERGE_STASH"
}restorestate() {
- if test -f "$GIT_DIR/MERGE_SAVE"
+ if test -f "$GIT_DIR/MERGE_STASH"
then
git reset --hard $head >/dev/null
- cpio -iuv <"$GIT_DIR/MERGE_SAVE"
+ git stash apply --index $(cat "$GIT_DIR/MERGE_STASH")
git update-index --refresh >/dev/null
fi
}
@@ -386,7 +385,7 @@ case "$use_strategies" in
single_strategy=no
;;
*)
- rm -f "$GIT_DIR/MERGE_SAVE"
+ rm -f "$GIT_DIR/MERGE_STASH"
single_strategy=yes
;;
esac
-
It is on Windows because busybox cpio is not really good and busybox
tar is even worse (for cpio emulation). Maybe I should just improve
busybox cpio :-)
--
Duy
-
Sounds sensible, as it (at least its -p mode of operation) is
one of the programs that is very useful yet not so well known to
people new to UNIX.-
Isn't "type" a bashism?
Maybe just do
if echo . | cpio -o > /dev/null 2>&1; then
instead? Maybe even doing this at install time to avoid the overhead of
executing another process..Linus
-
I think it's POSIX, and since I found the same construct in
git-mergetool.sh, I thought it would be okay for git.Mike
-
I seem to recall that it is in POSIX.
-
busybox ash has "type". I'm happy.
--
Duy
-
"type"? That's probably better than using "which", but sounds
quite wrong. Why not add Makefile target that the shell scripts
depend on to see if necessary tools are available and let the
builder know if they are not?
-
Hi,
I thought the accord was that "cpio" is a _runtime_ dependency. But yes,
I agree "type" is not necessarily the best choice. Maybe testing the exit
code for 127 (not found) is the better choice?Ciao,
Dscho-
Damn, and I forgot git-send-email doesn't add the <> to In-Reply-To.
Mike
-
| Heiko Carstens | Re: -mm merge plans for 2.6.23 -- sys_fallocate |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Eric W. Biederman | [PATCH 0/10] sysfs network namespace support |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | [GIT]: Networking |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Natalie Protasevich | [BUG] New Kernel Bugs |
