* [PATCH] Don't use cpio in git-clone when not installed
@ 2007-10-31 20:05 Mike Hommey
2007-10-31 20:10 ` Mike Hommey
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Mike Hommey @ 2007-10-31 20:05 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
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
fi
dir="$2"
--
1.5.3.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-10-31 20:05 [PATCH] Don't use cpio in git-clone when not installed Mike Hommey
@ 2007-10-31 20:10 ` Mike Hommey
2007-10-31 22:29 ` Junio C Hamano
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: Mike Hommey @ 2007-10-31 20:10 UTC (permalink / raw)
To: git
Damn, and I forgot git-send-email doesn't add the <> to In-Reply-To.
Mike
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-10-31 20:05 [PATCH] Don't use cpio in git-clone when not installed Mike Hommey
2007-10-31 20:10 ` Mike Hommey
@ 2007-10-31 22:29 ` Junio C Hamano
2007-10-31 23:55 ` Johannes Schindelin
2007-11-01 0:46 ` Linus Torvalds
2007-11-01 1:09 ` Nguyen Thai Ngoc Duy
3 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2007-10-31 22:29 UTC (permalink / raw)
To: Mike Hommey; +Cc: git
"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?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-10-31 22:29 ` Junio C Hamano
@ 2007-10-31 23:55 ` Johannes Schindelin
0 siblings, 0 replies; 16+ messages in thread
From: Johannes Schindelin @ 2007-10-31 23:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Mike Hommey, git
Hi,
On Wed, 31 Oct 2007, Junio C Hamano wrote:
> "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?
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-10-31 20:05 [PATCH] Don't use cpio in git-clone when not installed Mike Hommey
2007-10-31 20:10 ` Mike Hommey
2007-10-31 22:29 ` Junio C Hamano
@ 2007-11-01 0:46 ` Linus Torvalds
2007-11-01 1:00 ` Jakub Narebski
` (4 more replies)
2007-11-01 1:09 ` Nguyen Thai Ngoc Duy
3 siblings, 5 replies; 16+ messages in thread
From: Linus Torvalds @ 2007-11-01 0:46 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Junio C Hamano
On Wed, 31 Oct 2007, Mike Hommey wrote:
> + if type cpio > /dev/null 2>&1; then
> + local=yes
> + fi
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 0:46 ` Linus Torvalds
@ 2007-11-01 1:00 ` Jakub Narebski
2007-11-01 1:05 ` Nguyen Thai Ngoc Duy
` (3 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Jakub Narebski @ 2007-11-01 1:00 UTC (permalink / raw)
To: git
Linus Torvalds wrote:
>
>
> On Wed, 31 Oct 2007, Mike Hommey wrote:
>> + if type cpio > /dev/null 2>&1; then
>> + local=yes
>> + fi
>
> 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..
Or perhaps trap / check actual execution of cpio in git-clone, and
fallback to ln -s / link if it fails...
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 0:46 ` Linus Torvalds
2007-11-01 1:00 ` Jakub Narebski
@ 2007-11-01 1:05 ` Nguyen Thai Ngoc Duy
2007-11-01 1:12 ` Junio C Hamano
` (2 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-11-01 1:05 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Mike Hommey, git, Junio C Hamano
On 11/1/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>
> On Wed, 31 Oct 2007, Mike Hommey wrote:
> > + if type cpio > /dev/null 2>&1; then
> > + local=yes
> > + fi
>
> Isn't "type" a bashism?
busybox ash has "type". I'm happy.
--
Duy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-10-31 20:05 [PATCH] Don't use cpio in git-clone when not installed Mike Hommey
` (2 preceding siblings ...)
2007-11-01 0:46 ` Linus Torvalds
@ 2007-11-01 1:09 ` Nguyen Thai Ngoc Duy
2007-11-01 1:15 ` Junio C Hamano
3 siblings, 1 reply; 16+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-11-01 1:09 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Junio C Hamano
BTW, you have workaround for git-merge also? It uses cpio to save/restore state.
On 11/1/07, Mike Hommey <mh@glandium.org> wrote:
>
> 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
> fi
>
> dir="$2"
> --
> 1.5.3.4
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Duy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 0:46 ` Linus Torvalds
2007-11-01 1:00 ` Jakub Narebski
2007-11-01 1:05 ` Nguyen Thai Ngoc Duy
@ 2007-11-01 1:12 ` Junio C Hamano
2007-11-01 6:31 ` Mike Hommey
2007-11-01 13:06 ` Alexander Skwar
4 siblings, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2007-11-01 1:12 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Mike Hommey, git
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Wed, 31 Oct 2007, Mike Hommey wrote:
>> + if type cpio > /dev/null 2>&1; then
>> + local=yes
>> + fi
>
> Isn't "type" a bashism?
I seem to recall that it is in POSIX.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 1:09 ` Nguyen Thai Ngoc Duy
@ 2007-11-01 1:15 ` Junio C Hamano
2007-11-01 1:25 ` Nguyen Thai Ngoc Duy
2007-11-01 10:53 ` Mike Hommey
0 siblings, 2 replies; 16+ messages in thread
From: Junio C Hamano @ 2007-11-01 1:15 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: Mike Hommey, git, Junio C Hamano
"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:
> BTW, you have workaround for git-merge also? It uses cpio to save/restore state.
Why do people want "workaround"? Is installing cpio such a
hassle?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 1:15 ` Junio C Hamano
@ 2007-11-01 1:25 ` Nguyen Thai Ngoc Duy
2007-11-01 6:45 ` Junio C Hamano
2007-11-01 10:53 ` Mike Hommey
1 sibling, 1 reply; 16+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2007-11-01 1:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Mike Hommey, git
On 11/1/07, Junio C Hamano <gitster@pobox.com> wrote:
> "Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:
>
> > BTW, you have workaround for git-merge also? It uses cpio to save/restore state.
>
> Why do people want "workaround"? Is installing cpio such a
> hassle?
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 0:46 ` Linus Torvalds
` (2 preceding siblings ...)
2007-11-01 1:12 ` Junio C Hamano
@ 2007-11-01 6:31 ` Mike Hommey
2007-11-01 13:06 ` Alexander Skwar
4 siblings, 0 replies; 16+ messages in thread
From: Mike Hommey @ 2007-11-01 6:31 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git, Junio C Hamano
On Wed, Oct 31, 2007 at 05:46:40PM -0700, Linus Torvalds wrote:
>
>
> On Wed, 31 Oct 2007, Mike Hommey wrote:
> > + if type cpio > /dev/null 2>&1; then
> > + local=yes
> > + fi
>
> Isn't "type" a bashism?
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 1:25 ` Nguyen Thai Ngoc Duy
@ 2007-11-01 6:45 ` Junio C Hamano
0 siblings, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2007-11-01 6:45 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: Junio C Hamano, Mike Hommey, git
"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:
> 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 :-)
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.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 1:15 ` Junio C Hamano
2007-11-01 1:25 ` Nguyen Thai Ngoc Duy
@ 2007-11-01 10:53 ` Mike Hommey
2007-11-01 21:06 ` Junio C Hamano
1 sibling, 1 reply; 16+ messages in thread
From: Mike Hommey @ 2007-11-01 10:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nguyen Thai Ngoc Duy, git
On Wed, Oct 31, 2007 at 06:15:27PM -0700, Junio C Hamano wrote:
> "Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:
>
> > BTW, you have workaround for git-merge also? It uses cpio to save/restore state.
>
> 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 0:46 ` Linus Torvalds
` (3 preceding siblings ...)
2007-11-01 6:31 ` Mike Hommey
@ 2007-11-01 13:06 ` Alexander Skwar
4 siblings, 0 replies; 16+ messages in thread
From: Alexander Skwar @ 2007-11-01 13:06 UTC (permalink / raw)
To: git
Linus Torvalds <torvalds <at> linux-foundation.org> writes:
>
>
> On Wed, 31 Oct 2007, Mike Hommey wrote:
> > + if type cpio > /dev/null 2>&1; then
> > + local=yes
> > + fi
>
> Isn't "type" a bashism?
ksh also has type. But SUS states, that "command -v" can be used.
Options
[...]
-v
(On systems supporting the User Portability Utilities option.)
Write a string to standard output that indicates the pathname or
command that will be used by the shell, in the current shell
execution environment (see Shell Execution Environment ), to
invoke command_name, but do not invoke command_name.
* Utilities, regular built-in utilities, command_names
including a slash character, and any implementation-defined
functions that are found using the PATH variable (as
described in Command Search and Execution ), shall be
written as absolute pathnames.
* Shell functions, special built-in utilities, regular
built-in utilities not associated with a PATH search, and
shell reserved words shall be written as just their names.
* An alias shall be written as a command line that represents
its alias definition.
* Otherwise, no output shall be written and the exit status
shall reflect that the name was not found.
Regards,
Alexander
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Don't use cpio in git-clone when not installed
2007-11-01 10:53 ` Mike Hommey
@ 2007-11-01 21:06 ` Junio C Hamano
0 siblings, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2007-11-01 21:06 UTC (permalink / raw)
To: Mike Hommey; +Cc: Nguyen Thai Ngoc Duy, git
Mike Hommey <mh@glandium.org> writes:
> On Wed, Oct 31, 2007 at 06:15:27PM -0700, Junio C Hamano wrote:
>> "Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:
>>
>> > BTW, you have workaround for git-merge also? It uses cpio to save/restore state.
>>
>> 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.
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=t
dropsave() {
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
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-11-01 21:07 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-31 20:05 [PATCH] Don't use cpio in git-clone when not installed Mike Hommey
2007-10-31 20:10 ` Mike Hommey
2007-10-31 22:29 ` Junio C Hamano
2007-10-31 23:55 ` Johannes Schindelin
2007-11-01 0:46 ` Linus Torvalds
2007-11-01 1:00 ` Jakub Narebski
2007-11-01 1:05 ` Nguyen Thai Ngoc Duy
2007-11-01 1:12 ` Junio C Hamano
2007-11-01 6:31 ` Mike Hommey
2007-11-01 13:06 ` Alexander Skwar
2007-11-01 1:09 ` Nguyen Thai Ngoc Duy
2007-11-01 1:15 ` Junio C Hamano
2007-11-01 1:25 ` Nguyen Thai Ngoc Duy
2007-11-01 6:45 ` Junio C Hamano
2007-11-01 10:53 ` Mike Hommey
2007-11-01 21:06 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).