git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] filter-branch: really allow running in a bare repository
       [not found] <cover.1233684552u.git.johannes.schindelin@gmx.de>
@ 2009-02-03 18:10 ` Johannes Schindelin
  2009-02-03 19:31   ` Eric Kidd
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-02-03 18:10 UTC (permalink / raw)
  To: git; +Cc: gitster, Petr Baudis

When checking if running in a bare repository, the work tree has to be
reset, otherwise we will be checking the temporary state, which is
always non-bare.

This commit augments a4661b0(git-filter-branch.sh: Allow running in bare
repositories).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-filter-branch.sh |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index eb62f71..8cbce4e 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -469,19 +469,19 @@ rm -rf "$tempdir"
 
 trap - 0
 
+unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
+test -z "$ORIG_GIT_DIR" || {
+	GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
+}
+test -z "$ORIG_GIT_WORK_TREE" || {
+	GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
+	export GIT_WORK_TREE
+}
+test -z "$ORIG_GIT_INDEX_FILE" || {
+	GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" &&
+	export GIT_INDEX_FILE
+}
 if [ "$(is_bare_repository)" = false ]; then
-	unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
-	test -z "$ORIG_GIT_DIR" || {
-		GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
-	}
-	test -z "$ORIG_GIT_WORK_TREE" || {
-		GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
-		export GIT_WORK_TREE
-	}
-	test -z "$ORIG_GIT_INDEX_FILE" || {
-		GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" &&
-		export GIT_INDEX_FILE
-	}
 	git read-tree -u -m HEAD
 fi
 
-- 
1.6.1.2.574.g140d5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] filter-branch: really allow running in a bare repository
  2009-02-03 18:10 ` [PATCH] filter-branch: really allow running in a bare repository Johannes Schindelin
@ 2009-02-03 19:31   ` Eric Kidd
  2009-02-03 20:46     ` Johannes Schindelin
  2009-02-03 20:56     ` Eric Kidd
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Kidd @ 2009-02-03 19:31 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On Tue, Feb 3, 2009 at 1:10 PM, Johannes Schindelin
<johannes.schindelin@gmx.de> wrote:
> When checking if running in a bare repository, the work tree has to be
> reset, otherwise we will be checking the temporary state, which is
> always non-bare.

Just a few minutes after you posted this patch, I posted a
nearly-identical fix for the same issue:

  http://marc.info/?l=git&m=123368695831812&w=2

(My patch includes a test case, too, but it's not very important.)

This raises another interesting question: Why doesn't 'git
filter-branch' actually check whether subcommands succeed?

Cheers,
Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] filter-branch: really allow running in a bare repository
  2009-02-03 19:31   ` Eric Kidd
@ 2009-02-03 20:46     ` Johannes Schindelin
  2009-02-03 20:56     ` Eric Kidd
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2009-02-03 20:46 UTC (permalink / raw)
  To: Eric Kidd; +Cc: git

Hi,

On Tue, 3 Feb 2009, Eric Kidd wrote:

> On Tue, Feb 3, 2009 at 1:10 PM, Johannes Schindelin
> <johannes.schindelin@gmx.de> wrote:
> > When checking if running in a bare repository, the work tree has to be
> > reset, otherwise we will be checking the temporary state, which is
> > always non-bare.
> 
> Just a few minutes after you posted this patch, I posted a
> nearly-identical fix for the same issue:
> 
>   http://marc.info/?l=git&m=123368695831812&w=2
> 
> (My patch includes a test case, too, but it's not very important.)

So clearly yours is superior.

> This raises another interesting question: Why doesn't 'git
> filter-branch' actually check whether subcommands succeed?

That's unintentional; AFAIR there was a "set -e" in cg-admin-rewritehist 
that I tried to do away with by introducing explicit '&&' conjunctions 
where needed.

So all those unchecked subcommands are bugs.

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] filter-branch: really allow running in a bare repository
  2009-02-03 19:31   ` Eric Kidd
  2009-02-03 20:46     ` Johannes Schindelin
@ 2009-02-03 20:56     ` Eric Kidd
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Kidd @ 2009-02-03 20:56 UTC (permalink / raw)
  To: git

On Tue, Feb 3, 2009 at 2:31 PM, Eric Kidd <emk.lists@randomhacks.net> wrote:
> Just a few minutes after you posted this patch, I posted a
> nearly-identical fix for the same issue:
>
>  http://marc.info/?l=git&m=123368695831812&w=2

A point of clarification: These two bug fixes are independent, and I
was fighting with my mail queue when I saw Johannes' patch.

Cheers,
Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-03 20:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1233684552u.git.johannes.schindelin@gmx.de>
2009-02-03 18:10 ` [PATCH] filter-branch: really allow running in a bare repository Johannes Schindelin
2009-02-03 19:31   ` Eric Kidd
2009-02-03 20:46     ` Johannes Schindelin
2009-02-03 20:56     ` Eric Kidd

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).