* [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>
@ 2007-01-05 9:46 Junio C Hamano
2007-01-05 10:29 ` Johannes Schindelin
2007-01-05 16:17 ` Juergen Ruehle
0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-01-05 9:46 UTC (permalink / raw)
To: git; +Cc: Juergen Ruehle
When <path> exists in the index (either merged or unmerged), and
<tree> does not have it, git-reset should be usable to restore
the absense of it from the tree. This implements it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* By the way, I noticed that "git log --diff-filter=A --
t/t5401-update-hooks.sh" does not find the commit that
introduced the path. v1.4.1.1 seems to work but v1.4.2.4
does not. I haven't bisected it yet...
git-reset.sh | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-reset.sh b/git-reset.sh
index a969370..76c8a81 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -44,8 +44,10 @@ if test $# != 0
then
test "$reset_type" == "--mixed" ||
die "Cannot do partial $reset_type reset."
- git ls-tree -r --full-name $rev -- "$@" |
- git update-index --add --index-info || exit
+
+ git-diff-index --cached $rev -- "$@" |
+ sed -e 's/^:\([0-7][0-7]*\) [0-7][0-7]* \([0-9a-f][0-9a-f]*\) [0-9a-f][0-9a-f]* [A-Z] \(.*\)$/\1 \2 \3/' |
+ git update-index --add --remove --index-info || exit
git update-index --refresh
exit
fi
--
1.5.0.rc0.ge0f6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>
2007-01-05 9:46 [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree> Junio C Hamano
@ 2007-01-05 10:29 ` Johannes Schindelin
2007-01-05 11:09 ` Junio C Hamano
2007-01-05 16:17 ` Juergen Ruehle
1 sibling, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-01-05 10:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Fri, 5 Jan 2007, Junio C Hamano wrote:
> * By the way, I noticed that "git log --diff-filter=A --
> t/t5401-update-hooks.sh" does not find the commit that
> introduced the path. v1.4.1.1 seems to work but v1.4.2.4
> does not. I haven't bisected it yet...
It is this commit:
1798562: "log --raw: Don't descend into subdirectories by default"
And sure enough,
$ git log next -r --diff-filter=A -- t/t5401-update-hooks.sh
works.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>
2007-01-05 10:29 ` Johannes Schindelin
@ 2007-01-05 11:09 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-01-05 11:09 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hi,
>
> On Fri, 5 Jan 2007, Junio C Hamano wrote:
>
>> * By the way, I noticed that "git log --diff-filter=A --
>> t/t5401-update-hooks.sh" does not find the commit that
>> introduced the path. v1.4.1.1 seems to work but v1.4.2.4
>> does not. I haven't bisected it yet...
>
> It is this commit:
>
> 1798562: "log --raw: Don't descend into subdirectories by default"
>
> And sure enough,
>
> $ git log next -r --diff-filter=A -- t/t5401-update-hooks.sh
>
> works.
Soon after I accepted the patch, I had this exact reaction and
then after some digging I realized the workaround you showed
above. And I forgot all of them X-<. Silly me.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>
2007-01-05 9:46 [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree> Junio C Hamano
2007-01-05 10:29 ` Johannes Schindelin
@ 2007-01-05 16:17 ` Juergen Ruehle
1 sibling, 0 replies; 4+ messages in thread
From: Juergen Ruehle @ 2007-01-05 16:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano writes:
> When <path> exists in the index (either merged or unmerged), and
> <tree> does not have it, git-reset should be usable to restore
> the absense of it from the tree. This implements it.
Great! It took some time, but I think I understand now why the first
part was even necessary:-)
> diff --git a/git-reset.sh b/git-reset.sh
> index a969370..76c8a81 100755
> --- a/git-reset.sh
> +++ b/git-reset.sh
> @@ -44,8 +44,10 @@ if test $# != 0
> then
> test "$reset_type" == "--mixed" ||
> die "Cannot do partial $reset_type reset."
> - git ls-tree -r --full-name $rev -- "$@" |
> - git update-index --add --index-info || exit
> +
> + git-diff-index --cached $rev -- "$@" |
> + sed -e 's/^:\([0-7][0-7]*\) [0-7][0-7]* \([0-9a-f][0-9a-f]*\) [0-9a-f][0-9a-f]* [A-Z] \(.*\)$/\1 \2 \3/' |
> + git update-index --add --remove --index-info || exit
All other scripts calling update-index --index-info don't mention
add/remove (which are ignored anyway). Might be useful as a reminder
though.
> git update-index --refresh
> exit
> fi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-05 16:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-05 9:46 [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree> Junio C Hamano
2007-01-05 10:29 ` Johannes Schindelin
2007-01-05 11:09 ` Junio C Hamano
2007-01-05 16:17 ` Juergen Ruehle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox