* Re: git push mirror mode
From: Junio C Hamano @ 2007-11-08 21:53 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Andy Whitcroft, git
In-Reply-To: <Pine.LNX.4.64.0711081218090.4362@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Thu, 8 Nov 2007, Andy Whitcroft wrote:
>
>> Ok, sometime back Junio sent out a proof-of-concept change to
>> send-pack allowing a mirror mode.
>
> You added/left his sign-off, but did not attribute the patches to him.
No big deal; I do not think much of my changes remain in the
result. Mentioning "inspired by" would be nice as courtesy, but
I think this is mostly Andy's work.
As I haven't seen _his_ part of the change before he posted this
updated patch, copying my S-o-b line wasn't necessary either.
^ permalink raw reply
* [PATCH 3/3] Fix sed string regex escaping in module_name.
From: Ralf Wildenhues @ 2007-11-08 21:48 UTC (permalink / raw)
To: git
In-Reply-To: <20071108214624.GF31439@ins.uni-bonn.de>
When escaping a string to be used as a sed regex, it is important
to only escape active characters. Escaping other characters is
undefined according to POSIX, and in practice leads to issues with
extensions such as GNU sed's \+.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---
git-submodule.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 1c656be..82ac28f 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -74,7 +74,7 @@ resolve_relative_url ()
module_name()
{
# Do we have "submodule.<something>.path = $1" defined in .gitmodules file?
- re=$(printf '%s' "$1" | sed -e 's/\([^a-zA-Z0-9_]\)/\\\1/g')
+ re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
name=$( GIT_CONFIG=.gitmodules \
git config --get-regexp '^submodule\..*\.path$' |
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
--
1.5.3.5.561.g140d
^ permalink raw reply related
* [PATCH 2/3] Fix sed script to work with AIX and BSD sed.
From: Ralf Wildenhues @ 2007-11-08 21:48 UTC (permalink / raw)
To: git
In-Reply-To: <20071108214624.GF31439@ins.uni-bonn.de>
\n is not portable in a s/// replacement string, only
in the regex part. backslash-newline helps.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---
I'm a bit unsure whether you would prefer to avoid breaking the
indentation with something like
tr '|' '\n'
OTOH, \n in a tr set is not universally portable either (for example
Solaris /usr/ucb/tr mishandles it, and \012 fails on EBCDIC), but
I'm still on my way of finding out the level of portability you
prefer. ;-)
Cheers,
Ralf
git-bisect.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index c18bd32..3aac816 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -276,7 +276,8 @@ exit_if_skipped_commits () {
if expr "$_tried" : ".*[|].*" > /dev/null ; then
echo "There are only 'skip'ped commit left to test."
echo "The first bad commit could be any of:"
- echo "$_tried" | sed -e 's/[|]/\n/g'
+ echo "$_tried" | sed -e 's/[|]/\
+/g'
echo "We cannot bisect more!"
exit 2
fi
--
1.5.3.5.561.g140d
^ permalink raw reply related
* [PATCH 1/3] Avoid a few unportable, needlessly nested "...`...".
From: Ralf Wildenhues @ 2007-11-08 21:47 UTC (permalink / raw)
To: git
In-Reply-To: <20071108214624.GF31439@ins.uni-bonn.de>
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---
git-rebase--interactive.sh | 2 +-
git-request-pull.sh | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6d14092..66c80d4 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -392,7 +392,7 @@ do
-s|--strategy)
case "$#,$1" in
*,*=*)
- STRATEGY="-s `expr "z$1" : 'z-[^=]*=\(.*\)'`" ;;
+ STRATEGY="-s "$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
1,*)
usage ;;
*)
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 90d969c..068f5e0 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -25,13 +25,13 @@ headrev=`git rev-parse --verify "$head"^0` || exit
merge_base=`git merge-base $baserev $headrev` ||
die "fatal: No commits in common between $base and $head"
-url="`get_remote_url "$url"`"
-branch=`git peek-remote "$url" \
+url=$(get_remote_url "$url")
+branch=$(git peek-remote "$url" \
| sed -n -e "/^$headrev refs.heads./{
s/^.* refs.heads.//
p
q
- }"`
+ }")
if [ -z "$branch" ]; then
echo "warn: No branch of $url is at:" >&2
git log --max-count=1 --pretty='format:warn: %h: %s' $headrev >&2
--
1.5.3.5.561.g140d
^ permalink raw reply related
* [PATCH 0/3] some shell portability fixes, v2
From: Ralf Wildenhues @ 2007-11-08 21:46 UTC (permalink / raw)
To: git
Thanks for all the helpful feedback. Here's a new series that drops the
$(()) and test -a/-o patches, and otherwise hopefully incorporates all
nits.
Cheers,
Ralf
^ permalink raw reply
* Re: Inconsistencies with git log
From: Alex Riesen @ 2007-11-08 21:23 UTC (permalink / raw)
To: David Symonds
Cc: Andreas Ericsson, Brian Gernhardt, Jon Smirl, Johannes Schindelin,
Git Mailing List
In-Reply-To: <20071108212123.GA4899@steel.home>
Alex Riesen, Thu, Nov 08, 2007 22:21:23 +0100:
> David Symonds, Thu, Nov 08, 2007 14:16:59 +0100:
> > I never suggested path *limited*, only path *relative*. git-status
> > would still show all the same files, but their paths would be relative
> > to your current directory, so there'd be no confusion like you
> > mentioned. This is how Johannes' patch works.
>
> Relative? Like this?
>
> $ cd project/foo/bar
> $ git status
> ...
> M file1.c
> M file2.c
> M ../baz/file3.c
> R ../bax/file4 => file4.c
>
Oh, I see. Yes. Cool.
^ permalink raw reply
* Re: Inconsistencies with git log
From: Alex Riesen @ 2007-11-08 21:21 UTC (permalink / raw)
To: David Symonds
Cc: Andreas Ericsson, Brian Gernhardt, Jon Smirl, Johannes Schindelin,
Git Mailing List
In-Reply-To: <ee77f5c20711080516n4f207ba3pccc8efffa2a6ad4c@mail.gmail.com>
David Symonds, Thu, Nov 08, 2007 14:16:59 +0100:
> I never suggested path *limited*, only path *relative*. git-status
> would still show all the same files, but their paths would be relative
> to your current directory, so there'd be no confusion like you
> mentioned. This is how Johannes' patch works.
Relative? Like this?
$ cd project/foo/bar
$ git status
...
M file1.c
M file2.c
M ../baz/file3.c
R ../bax/file4 => file4.c
^ permalink raw reply
* Re: [PATCH] Drop deprecated commands from git(7) and update deprecation notices
From: Junio C Hamano @ 2007-11-08 21:01 UTC (permalink / raw)
To: Jonas Fonseca; +Cc: Andreas Ericsson, Johannes Schindelin, git
In-Reply-To: <20071108160114.GB20988@diku.dk>
Thanks.
But lost-found is merely deprecated but not removed yet, so I
think it should be kept in the list cmd-list.perl generates.
We may want a mechanism to mark it deprecated in the list as
well, though. Perhaps ...
---
Documentation/cmd-list.perl | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 8d21d42..0066064 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,7 +3,8 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $name) = @_;
+ my ($out, $nameattr) = @_;
+ my ($name, $attr) = @$nameattr;
my ($state, $description);
$state = 0;
open I, '<', "$name.txt" or die "No such file $name.txt";
@@ -26,8 +27,11 @@ sub format_one {
die "No description found in $name.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
- print $out "gitlink:$name\[1\]::\n";
- print $out "\t$text.\n\n";
+ print $out "gitlink:$name\[1\]::\n\t";
+ if ($attr) {
+ print $out "($attr) ";
+ }
+ print $out "$text.\n\n";
}
else {
die "Description does not match $name: $description";
@@ -39,8 +43,8 @@ while (<DATA>) {
next if /^#/;
chomp;
- my ($name, $cat) = /^(\S+)\s+(.*)$/;
- push @{$cmds{$cat}}, $name;
+ my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
+ push @{$cmds{$cat}}, [$name, $attr];
}
for my $cat (qw(ancillaryinterrogators
@@ -126,7 +130,7 @@ git-instaweb ancillaryinterrogators
gitk mainporcelain
git-local-fetch synchingrepositories
git-log mainporcelain
-git-lost-found ancillarymanipulators
+git-lost-found ancillarymanipulators deprecated
git-ls-files plumbinginterrogators
git-ls-remote plumbinginterrogators
git-ls-tree plumbinginterrogators
^ permalink raw reply related
* Re: [NEW REPLACEMENT PATCH] git-checkout: Add a test case for relative paths use.
From: Junio C Hamano @ 2007-11-08 20:48 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: David Symonds, git, Andreas Ericsson
In-Reply-To: <Pine.LNX.4.64.0711081427450.4362@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> + mkdir dir2 &&
>> + echo bonjour > dir2/file2 &&
>> + git add dir2/file2 &&
>> + git commit -m "populate tree"
>> +
>> +'
>
> Please lose the empty line before the closing quote. (This applies to all
> tests.)
I personaly find the extra blank lines before and after the
indented test body easier to read. That is..
test_expect_sucess 'test description comes here' '
test command 1 &&
test command 2 &&
...
test command N
'
I agree with all other suggestions from your message.
^ permalink raw reply
* [PATCH] nicer display of thin pack completion
From: Nicolas Pitre @ 2007-11-08 20:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In the same spirit of prettifying Git's output display for mere mortals,
here's a simple extension to the progress API allowing for a final
message to be provided when terminating a progress line, and use it for
the display of the number of objects needed to complete a thin pack,
saving yet one more line of screen display.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
diff --git a/index-pack.c b/index-pack.c
index 581a7f5..469a330 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -792,6 +792,7 @@ int main(int argc, char **argv)
flush();
} else {
if (fix_thin_pack) {
+ char msg[48];
int nr_unresolved = nr_deltas - nr_resolved_deltas;
int nr_objects_initial = nr_objects;
if (nr_unresolved <= 0)
@@ -800,12 +801,11 @@ int main(int argc, char **argv)
(nr_objects + nr_unresolved + 1)
* sizeof(*objects));
fix_unresolved_deltas(nr_unresolved);
- stop_progress(&progress);
- if (verbose)
- fprintf(stderr, "%d objects were added to complete this thin pack.\n",
- nr_objects - nr_objects_initial);
+ sprintf(msg, "completed with %d local objects",
+ nr_objects - nr_objects_initial);
+ stop_progress_msg(&progress, msg);
fixup_pack_header_footer(output_fd, sha1,
- curr_pack, nr_objects);
+ curr_pack, nr_objects);
}
if (nr_deltas != nr_resolved_deltas)
die("pack has %d unresolved deltas",
diff --git a/progress.c b/progress.c
index 0700dcf..4bd650f 100644
--- a/progress.c
+++ b/progress.c
@@ -69,9 +69,9 @@ static void clear_progress_signal(void)
progress_update = 0;
}
-static int display(struct progress *progress, unsigned n, int done)
+static int display(struct progress *progress, unsigned n, const char *done)
{
- char *eol, *tp;
+ const char *eol, *tp;
if (progress->delay) {
if (!progress_update || --progress->delay)
@@ -90,7 +90,7 @@ static int display(struct progress *progress, unsigned n, int done)
progress->last_value = n;
tp = (progress->throughput) ? progress->throughput->display : "";
- eol = done ? ", done. \n" : " \r";
+ eol = done ? done : " \r";
if (progress->total) {
unsigned percent = n * 100 / progress->total;
if (percent != progress->last_percent || progress_update) {
@@ -191,13 +191,13 @@ void display_throughput(struct progress *progress, off_t total)
throughput_string(tp, total, rate);
if (progress->last_value != -1 && progress_update)
- display(progress, progress->last_value, 0);
+ display(progress, progress->last_value, NULL);
}
}
int display_progress(struct progress *progress, unsigned n)
{
- return progress ? display(progress, n, 0) : 0;
+ return progress ? display(progress, n, NULL) : 0;
}
struct progress *start_progress_delay(const char *title, unsigned total,
@@ -227,12 +227,18 @@ struct progress *start_progress(const char *title, unsigned total)
void stop_progress(struct progress **p_progress)
{
+ stop_progress_msg(p_progress, "done");
+}
+
+void stop_progress_msg(struct progress **p_progress, const char *msg)
+{
struct progress *progress = *p_progress;
if (!progress)
return;
*p_progress = NULL;
if (progress->last_value != -1) {
/* Force the last update */
+ char buf[strlen(msg) + 5];
struct throughput *tp = progress->throughput;
if (tp) {
unsigned int rate = !tp->avg_misecs ? 0 :
@@ -240,7 +246,8 @@ void stop_progress(struct progress **p_progress)
throughput_string(tp, tp->curr_total, rate);
}
progress_update = 1;
- display(progress, progress->last_value, 1);
+ sprintf(buf, ", %s.\n", msg);
+ display(progress, progress->last_value, buf);
}
clear_progress_signal();
free(progress->throughput);
diff --git a/progress.h b/progress.h
index 3912969..611e4c4 100644
--- a/progress.h
+++ b/progress.h
@@ -9,5 +9,6 @@ struct progress *start_progress(const char *title, unsigned total);
struct progress *start_progress_delay(const char *title, unsigned total,
unsigned percent_treshold, unsigned delay);
void stop_progress(struct progress **progress);
+void stop_progress_msg(struct progress **progress, const char *msg);
#endif
^ permalink raw reply related
* Re: What's cooking in git.git (topics)
From: Steffen Prohaska @ 2007-11-08 20:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vir4d40sw.fsf@gitster.siamese.dyndns.org>
On Nov 8, 2007, at 9:08 AM, Junio C Hamano wrote:
> * sp/push-refspec (Sun Oct 28 18:46:20 2007 +0100) 5 commits
> - push: teach push to pass --verbose option to transport layer
> - push: use same rules as git-rev-parse to resolve refspecs
> - add ref_abbrev_matches_full_with_rev_parse_rules() comparing
> abbrev with full ref name
> - rename ref_matches_abbrev() to
> ref_abbrev_matches_full_with_fetch_rules()
> - push: support pushing HEAD to real branch name
>
> Really need to look at this series to merge to 'next'. Sorry.
Take your time. There is a slight chance that I'll unify
ref_abbrev_matches_full_with_rev_parse_rules() and
ref_abbrev_matches_full_with_fetch_rules() over the weekend.
Steffen
^ permalink raw reply
* Re: [PATCH 4/3] t3700: avoid racy git situation
From: Junio C Hamano @ 2007-11-08 20:42 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Johannes Sixt, git, krh
In-Reply-To: <Pine.LNX.4.64.0711081511440.4362@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> The problem is that the index has the same timestamp as the file "foo".
>
> Therefore, git cannot tell if "foo" is up-to-date in the index, since it
> could have been modified (and indeed is) just a fraction of a second later
> than the index was last updated.
>
> And since diff-index, as called from the test script, does not generate a
> diff, but really only determines if the index information suggests that
> the files are up-to-date, there is not really much you can do.
>
> This is our good old friend, the racy git problem.
That sounds very wrong.
What happened to the ce_smudge_racily_clean_entry() call that is
done from write_index()?
> NOTE: other scms do not have this problem, mostly because they are too
> slow to trigger it.
I recall racy-hg mentioned on their development list twice, a
few months apart, and CVS has the "delay the return from a
commit to the next full second" or something to work around
problems in the timestamp recorded in CVS/Entries.
^ permalink raw reply
* [PATCH] git-cvsimport: fix handling of user name when it is not set in CVSROOT
From: Gordon Hopper @ 2007-11-08 20:15 UTC (permalink / raw)
To: git; +Cc: gitster
The cvs programs do not default to "anonymous" as the user name, but use the
currently logged in user. This patch more closely matches the cvs behavior.
Signed-off-by: Gordon Hopper <g.hopper@computer.org>
---
git-cvsimport.perl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index e4bc2b5..efa6a0c 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -223,7 +223,8 @@ sub conn {
}
}
- $user="anonymous" unless defined $user;
+ # if username is not explicit in CVSROOT, then use current user, as cvs would
+ $user=(getlogin() || $ENV{'LOGNAME'} || $ENV{'USER'} ||
"anonymous") unless $user;
my $rr2 = "-";
unless ($port) {
$rr2 = ":pserver:$user\@$serv:$repo";
--
1.5.3.5
^ permalink raw reply related
* Re: git rebase --skip
From: Mike Hommey @ 2007-11-08 19:22 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Björn Steinbrink, Jeff King, git
In-Reply-To: <20071108191601.GA22353@glandium.org>
On Thu, Nov 08, 2007 at 08:16:01PM +0100, Mike Hommey wrote:
> On Thu, Nov 08, 2007 at 01:43:05PM -0500, Daniel Barkalow wrote:
> > > git commit
> > > git rebase --skip
> >
> > I guess that works, and nothing else presently does. But I don't think
> > that's at all intuitive as the correct thing to do (plus it feels too easy
> > to get into losing your commit message). Maybe we should have a "git
> > rebase --amend", which does the obvious thing (acts like --continue, but
> > lets you edit the message). It's not like you just did something totally
> > different; the commit is still the replacement for D, it's just less the
> > same.
>
> Maybe some commands such as commit should fail or at least emit warning
> when used during a rebase ?
Or, in the present case, doing the same as what "edit" would do in a
git-rebase --interactive could be enough.
Mike
^ permalink raw reply
* Re: git rebase --skip
From: Mike Hommey @ 2007-11-08 19:16 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Björn Steinbrink, Jeff King, git
In-Reply-To: <Pine.LNX.4.64.0711081332550.29952@iabervon.org>
On Thu, Nov 08, 2007 at 01:43:05PM -0500, Daniel Barkalow wrote:
> > git commit
> > git rebase --skip
>
> I guess that works, and nothing else presently does. But I don't think
> that's at all intuitive as the correct thing to do (plus it feels too easy
> to get into losing your commit message). Maybe we should have a "git
> rebase --amend", which does the obvious thing (acts like --continue, but
> lets you edit the message). It's not like you just did something totally
> different; the commit is still the replacement for D, it's just less the
> same.
Maybe some commands such as commit should fail or at least emit warning
when used during a rebase ?
Mike
^ permalink raw reply
* GIT_DIR/--git-dir question
From: Joakim Tjernlund @ 2007-11-08 19:06 UTC (permalink / raw)
To: git
I just started to look at having multiple work trees, each working on a separate branch,
using the same git repo.
GIT_DIR/--git-dir seems to be what I am looking for but I wonder if there
is a way to store the value of GIT_DIR/--git-dir in the working tree
somehow?
Jocke
^ permalink raw reply
* [PATCH] git-send-email: Change the prompt for the subject of the initial message.
From: Benoit Sigoure @ 2007-11-08 18:56 UTC (permalink / raw)
To: git; +Cc: gitster, Benoit Sigoure
I never understood what this prompt was asking for until I read the actual
source code. I think this wording is much more understandable.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
---
git-send-email.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index f4b8f96..f9bd2e5 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -352,7 +352,7 @@ sub expand_aliases {
if (!defined $initial_subject && $compose) {
do {
- $_ = $term->readline("What subject should the emails start with? ",
+ $_ = $term->readline("What subject should the initial email start with? ",
$initial_subject);
} while (!defined $_);
$initial_subject = $_;
--
1.5.3.4.398.g859b
^ permalink raw reply related
* Re: git rebase --skip
From: Daniel Barkalow @ 2007-11-08 18:43 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: Jeff King, Mike Hommey, git
In-Reply-To: <20071108102412.GA31187@atjola.homenet>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1662 bytes --]
On Thu, 8 Nov 2007, Björn Steinbrink wrote:
> On 2007.11.07 22:23:10 -0500, Jeff King wrote:
> > On Wed, Nov 07, 2007 at 11:21:05PM +0100, Mike Hommey wrote:
> >
> > > I use git-rebase quite regularly, and I haven't used git-rebase --skip
> > > after a failed merge without first resetting the working tree. I was
> > > wondering if it wouldn't make sense to automatically do the reset when
> > > running git-rebase --skip.
> >
> > I have often been annoyed by this behavior, too, and I can't think of
> > any situation where you _wouldn't_ want the reset to happen. But I
> > would be more comfortable hearing confirmation from others that they
> > can't think of such a situation.
>
> Let's take this history:
>
> C---D---E topic
> /
> A---B master
>
> You then do:
> git rebase master topic
>
> Now D causes conflicts, because B did a similar change, but not quite
> the same, maybe having a bug. So you want to keep parts of D, but it's
> no longer the same commit semantically and the original commit message
> would be bogus. So you resolve the conflicts and do:
>
> git commit
> git rebase --skip
I guess that works, and nothing else presently does. But I don't think
that's at all intuitive as the correct thing to do (plus it feels too easy
to get into losing your commit message). Maybe we should have a "git
rebase --amend", which does the obvious thing (acts like --continue, but
lets you edit the message). It's not like you just did something totally
different; the commit is still the replacement for D, it's just less the
same.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: [PATCH v2] user-manual: add advanced topic "bisecting merges"
From: Brian Gernhardt @ 2007-11-08 18:38 UTC (permalink / raw)
To: Benoit Sigoure
Cc: Steffen Prohaska, Johannes Sixt, Andreas Ericsson,
Ralf Wildenhues, Git Mailing List
In-Reply-To: <5498B368-053A-424E-B901-A55B66FF5801@lrde.epita.fr>
On Nov 8, 2007, at 9:51 AM, Benoit Sigoure wrote:
> You're missing the point. Johannes suggested that you rebase *only*
> for bisecting purpose. Once you find the culprit commit, throw away
> your rebased stuff. I've never thought about doing this myself, but
> it's a very clever way of tackling this problem. It's slightly less
> convenient if you need to bisect a large portion of the history
> (that involves many branches and merges) because in this case we'd
> like to have a magic git-linearize-history <start-treeish> <end-
> treeish>. Unless this is already easily doable with git-rebase?
I don't think you have to linearize it before bisecting. If you
bisect and discover that it was due to a merge, then you can rebase
*that merge* to discover what part of the merge caused the issue.
~~ Brian
^ permalink raw reply
* Re: [PATCH] rebase: operate on a detached HEAD
From: Nicolas Pitre @ 2007-11-08 18:28 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Junio C Hamano
In-Reply-To: <Pine.LNX.4.64.0711081818330.4362@racer.site>
On Thu, 8 Nov 2007, Johannes Schindelin wrote:
>
> The interactive version of rebase does all the operations on a detached
> HEAD, so that after a successful rebase, <branch>@{1} is the pre-rebase
> state. The reflogs of "HEAD" still show all the actions in detail.
>
> This teaches the non-interactive version to do the same.
I like this.
Nicolas
^ permalink raw reply
* Re: Inconsistencies with git log
From: Daniel Barkalow @ 2007-11-08 18:28 UTC (permalink / raw)
To: Jon Smirl; +Cc: Johannes Schindelin, Git Mailing List
In-Reply-To: <9e4733910711071529m604f3b12v29b3a040074ea4e@mail.gmail.com>
On Wed, 7 Nov 2007, Jon Smirl wrote:
> On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Hi,
> >
> > On Wed, 7 Nov 2007, Jon Smirl wrote:
> >
> > > On 11/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > >
> > > > We also tend to take the approach of viewing the history as that of
> > > > the whole project.
> > >
> > > But if you type 'git log' while cd'd into a subdirectory the whole log
> > > is almost never what you want. It's this kind of thing that makes git
> > > harder to use.
> >
> > When I am working in a subdirectory, I often want the whole history. For
> > example, when I am working on the documentation, sometimes I need to look
> > up a commit real quick, that touched other parts.
> >
> > Besides, adding a space and a dot is not what qualifies for "harder to
> > use" with this developer.
>
> So if git log is always whole tree, why doesn't this work?
>
> cd arch/powerpc/platforms/52xx
> git log arch/powerpc/platforms/52xx
> fatal: ambiguous argument 'arch/powerpc/platforms/52xx': unknown
> revision or path not in the working tree.
> Use '--' to separate paths from revisions
>
> It's not consistent. git log with no parameters is relative to the
> project root, git log with a parameter is relative to the current
> directory.
git log with no parameters is still relative to the current directory.
It's just not limited by paths at all, so what it's relative to doesn't
matter.
Since it shows is commits that change any of the given paths, the
perfectly consistant thing to do without any paths would be to show no
commits. Of course, that's totally useless, so we default to making no
limitation instead.
If there were any other options that took paths or filenames, they'd be
relative to the subdirectory, regardless of whether there were any paths,
and having no paths would still show history for the project without
regard to whether commits touch paths.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* [PATCH] rebase: operate on a detached HEAD
From: Johannes Schindelin @ 2007-11-08 18:19 UTC (permalink / raw)
To: git, gitster
The interactive version of rebase does all the operations on a detached
HEAD, so that after a successful rebase, <branch>@{1} is the pre-rebase
state. The reflogs of "HEAD" still show all the actions in detail.
This teaches the non-interactive version to do the same.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
git-rebase.sh | 56 ++++++++++++++++++++++++++++++++++++++++++----
t/t3402-rebase-merge.sh | 7 +++++-
2 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 8814be9..3684a31 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -88,7 +88,7 @@ call_merge () {
cmt="$(cat "$dotest/cmt.$1")"
echo "$cmt" > "$dotest/current"
hd=$(git rev-parse --verify HEAD)
- cmt_name=$(git symbolic-ref HEAD)
+ cmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)
msgnum=$(cat "$dotest/msgnum")
end=$(cat "$dotest/end")
eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
@@ -116,7 +116,24 @@ call_merge () {
esac
}
+move_to_original_branch () {
+ test -z "$head_name" &&
+ head_name="$(cat "$dotest"/head-name)" &&
+ onto="$(cat "$dotest"/onto)" &&
+ orig_head="$(cat "$dotest"/orig-head)"
+ case "$head_name" in
+ refs/*)
+ message="rebase finished: $head_name onto $onto"
+ git update-ref -m "$message" \
+ $head_name $(git rev-parse HEAD) $orig_head &&
+ git symbolic-ref HEAD $head_name ||
+ die "Could not move back to $head_name"
+ ;;
+ esac
+}
+
finish_rb_merge () {
+ move_to_original_branch
rm -r "$dotest"
echo "All done."
}
@@ -175,16 +192,23 @@ do
finish_rb_merge
exit
fi
- git am -3 --skip --resolvemsg="$RESOLVEMSG"
+ head_name=$(cat .dotest/head-name) &&
+ onto=$(cat .dotest/onto) &&
+ orig_head=$(cat .dotest/orig-head) &&
+ git am -3 --skip --resolvemsg="$RESOLVEMSG" &&
+ move_to_original_branch
exit
;;
--abort)
git rerere clear
if test -d "$dotest"
then
+ move_to_original_branch
rm -r "$dotest"
elif test -d .dotest
then
+ dotest=.dotest
+ move_to_original_branch
rm -r .dotest
else
die "No rebase in progress?"
@@ -320,6 +344,19 @@ then
GIT_PAGER='' git diff --stat --summary "$mb" "$onto"
fi
+# move to a detached HEAD
+orig_head=$(git rev-parse HEAD^0)
+head_name=$(git symbolic-ref HEAD 2> /dev/null)
+case "$head_name" in
+'')
+ head_name="detached HEAD"
+ ;;
+*)
+ git checkout "$orig_head" > /dev/null 2>&1 ||
+ die "could not detach HEAD"
+ ;;
+esac
+
# Rewind the head to "$onto"; this saves our current head in ORIG_HEAD.
echo "First, rewinding head to replay your work on top of it..."
git-reset --hard "$onto"
@@ -329,14 +366,21 @@ git-reset --hard "$onto"
if test "$mb" = "$branch"
then
echo >&2 "Fast-forwarded $branch_name to $onto_name."
+ move_to_original_branch
exit 0
fi
if test -z "$do_merge"
then
git format-patch -k --stdout --full-index --ignore-if-in-upstream "$upstream"..ORIG_HEAD |
- git am $git_am_opt --binary -3 -k --resolvemsg="$RESOLVEMSG"
- exit $?
+ git am $git_am_opt --binary -3 -k --resolvemsg="$RESOLVEMSG" &&
+ move_to_original_branch
+ ret=$?
+ test 0 != $ret -a -d .dotest &&
+ echo $head_name > .dotest/head-name &&
+ echo $onto > .dotest/onto &&
+ echo $orig_head > .dotest/orig-head
+ exit $ret
fi
# start doing a rebase with git-merge
@@ -345,8 +389,10 @@ fi
mkdir -p "$dotest"
echo "$onto" > "$dotest/onto"
echo "$onto_name" > "$dotest/onto_name"
-prev_head=`git rev-parse HEAD^0`
+prev_head=$orig_head
echo "$prev_head" > "$dotest/prev_head"
+echo "$orig_head" > "$dotest/orig-head"
+echo "$head_name" > "$dotest/head-name"
msgnum=0
for cmt in `git rev-list --reverse --no-merges "$upstream"..ORIG_HEAD`
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
index 0779aaa..7b7d072 100755
--- a/t/t3402-rebase-merge.sh
+++ b/t/t3402-rebase-merge.sh
@@ -48,9 +48,14 @@ test_expect_success 'reference merge' '
git merge -s recursive "reference merge" HEAD master
'
+PRE_REBASE=$(git rev-parse test-rebase)
test_expect_success rebase '
git checkout test-rebase &&
- git rebase --merge master
+ GIT_TRACE=1 git rebase --merge master
+'
+
+test_expect_success 'test-rebase@{1} is pre rebase' '
+ test $PRE_REBASE = $(git rev-parse test-rebase@{1})
'
test_expect_success 'merge and rebase should match' '
--
1.5.3.5.1634.g0fa78
^ permalink raw reply related
* [PATCH 3/4] git-push: plumb in --mirror mode
From: Andy Whitcroft @ 2007-11-08 17:01 UTC (permalink / raw)
To: git
In-Reply-To: <20071108165801.GM9736@shadowen.org>
Plumb in the --mirror mode for git-push.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
builtin-push.c | 14 ++++++++++++--
transport.c | 7 +++++++
transport.h | 1 +
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/builtin-push.c b/builtin-push.c
index 2c56195..d49157c 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -10,7 +10,7 @@
#include "parse-options.h"
static const char * const push_usage[] = {
- "git-push [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
+ "git-push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
NULL,
};
@@ -91,6 +91,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
{
int flags = 0;
int all = 0;
+ int mirror = 0;
int dry_run = 0;
int force = 0;
int tags = 0;
@@ -100,6 +101,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
OPT__VERBOSE(&verbose),
OPT_STRING( 0 , "repo", &repo, "repository", "repository"),
OPT_BOOLEAN( 0 , "all", &all, "push all refs"),
+ OPT_BOOLEAN( 0 , "mirror", &mirror, "mirror all refs"),
OPT_BOOLEAN( 0 , "tags", &tags, "push tags"),
OPT_BOOLEAN( 0 , "dry-run", &dry_run, "dry run"),
OPT_BOOLEAN('f', "force", &force, "force updates"),
@@ -119,13 +121,21 @@ int cmd_push(int argc, const char **argv, const char *prefix)
add_refspec("refs/tags/*");
if (all)
flags |= TRANSPORT_PUSH_ALL;
+ if (mirror)
+ flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
if (argc > 0) {
repo = argv[0];
set_refspecs(argv + 1, argc - 1);
}
- if ((flags & TRANSPORT_PUSH_ALL) && refspec)
+ if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) && refspec)
usage_with_options(push_usage, options);
+ if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) ==
+ (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) {
+ error("--all and --mirror are incompatible");
+ usage_with_options(push_usage, options);
+ }
+
return do_push(repo, flags);
}
diff --git a/transport.c b/transport.c
index f4577b7..08e62b1 100644
--- a/transport.c
+++ b/transport.c
@@ -284,6 +284,9 @@ static int rsync_transport_push(struct transport *transport,
struct child_process rsync;
const char *args[10];
+ if (flags & TRANSPORT_PUSH_MIRROR)
+ return error("rsync transport does not support mirror mode");
+
/* first push the objects */
strbuf_addstr(&buf, transport->url);
@@ -386,6 +389,9 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
int argc;
int err;
+ if (flags & TRANSPORT_PUSH_MIRROR)
+ return error("http transport does not support mirror mode");
+
argv = xmalloc((refspec_nr + 11) * sizeof(char *));
argv[0] = "http-push";
argc = 1;
@@ -653,6 +659,7 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
args.receivepack = data->receivepack;
args.send_all = !!(flags & TRANSPORT_PUSH_ALL);
+ args.send_mirror = !!(flags & TRANSPORT_PUSH_MIRROR);
args.force_update = !!(flags & TRANSPORT_PUSH_FORCE);
args.use_thin_pack = data->thin;
args.verbose = transport->verbose;
diff --git a/transport.h b/transport.h
index d27f562..7f337d2 100644
--- a/transport.h
+++ b/transport.h
@@ -30,6 +30,7 @@ struct transport {
#define TRANSPORT_PUSH_ALL 1
#define TRANSPORT_PUSH_FORCE 2
#define TRANSPORT_PUSH_DRY_RUN 4
+#define TRANSPORT_PUSH_MIRROR 8
/* Returns a transport suitable for the url */
struct transport *transport_get(struct remote *, const char *);
^ permalink raw reply related
* [PATCH 4/4] tests: git push mirror mode tests
From: Andy Whitcroft @ 2007-11-08 17:01 UTC (permalink / raw)
To: git
In-Reply-To: <20071108165801.GM9736@shadowen.org>
Add some basic tests for git push --mirror mode.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
t/t5517-push-mirror.sh | 101 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 101 insertions(+), 0 deletions(-)
diff --git a/t/t5517-push-mirror.sh b/t/t5517-push-mirror.sh
new file mode 100755
index 0000000..1a285d4
--- /dev/null
+++ b/t/t5517-push-mirror.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+test_description='pushing to a mirror repository'
+
+. ./test-lib.sh
+
+D=`pwd`
+
+mk_repo_pair () {
+ rm -rf master mirror &&
+ mkdir mirror && cd mirror &&
+ git init &&
+ cd .. &&
+ mkdir master && cd master &&
+ git init &&
+ git config remote.up.url ../mirror &&
+ cd ..
+}
+
+test_expect_success 'push mirror does not create new branches' '
+
+ mk_repo_pair &&
+ cd master &&
+ echo one >foo && git add foo && git commit -m one &&
+ master_master=$(git show-ref -s --verify refs/heads/master) &&
+ git push --mirror up &&
+ cd ../mirror &&
+ mirror_master=$(git show-ref -s --verify refs/heads/master) &&
+ test "$master_master" = "$mirror_master"
+
+'
+
+test_expect_success 'push mirror does not update existing branches' '
+
+ mk_repo_pair &&
+ cd master &&
+ echo one >foo && git add foo && git commit -m one &&
+ git push --mirror up &&
+ echo two >foo && git add foo && git commit -m two &&
+ master_master=$(git show-ref -s --verify refs/heads/master) &&
+ git push --mirror up &&
+ cd ../mirror &&
+ mirror_master=$(git show-ref -s --verify refs/heads/master) &&
+ test "$master_master" = "$mirror_master"
+
+'
+
+test_expect_success 'push mirror does not force update existing branches' '
+
+ mk_repo_pair &&
+ cd master &&
+ echo one >foo && git add foo && git commit -m one &&
+ git push --mirror up &&
+ echo two >foo && git add foo && git commit -m two &&
+ git push --mirror up &&
+ git reset --hard HEAD^
+ master_master=$(git show-ref -s --verify refs/heads/master) &&
+ git push --mirror up &&
+ cd ../mirror &&
+ mirror_master=$(git show-ref -s --verify refs/heads/master) &&
+ test "$master_master" = "$mirror_master"
+
+'
+
+test_expect_failure 'push mirror does not remove branches' '
+
+ mk_repo_pair &&
+ cd master &&
+ echo one >foo && git add foo && git commit -m one &&
+ git branch remove master &&
+ git push --mirror up &&
+ git branch -D remove
+ git push --mirror up &&
+ cd ../mirror &&
+ git show-ref -s --verify refs/heads/remove
+
+'
+
+test_expect_success 'push mirror does not add, update and remove together' '
+
+ mk_repo_pair &&
+ cd master &&
+ echo one >foo && git add foo && git commit -m one &&
+ git branch remove master &&
+ git push --mirror up &&
+ git branch -D remove &&
+ git branch add master &&
+ echo two >foo && git add foo && git commit -m two &&
+ master_master=$(git show-ref -s --verify refs/heads/master) &&
+ master_add=$(git show-ref -s --verify refs/heads/add) &&
+ git push --mirror up &&
+ cd ../mirror &&
+ mirror_master=$(git show-ref -s --verify refs/heads/master) &&
+ mirror_add=$(git show-ref -s --verify refs/heads/add) &&
+ test "$master_master" = "$mirror_master" &&
+ test "$master_add" = "$mirror_add" &&
+ ! git show-ref -s --verify refs/heads/remove
+
+'
+
+test_done
^ permalink raw reply related
* [PATCH 2/4] mirror pushing -- clean up match_refs flags
From: Andy Whitcroft @ 2007-11-08 17:01 UTC (permalink / raw)
To: git
In-Reply-To: <20071108165801.GM9736@shadowen.org>
Add a new enum to define the match_refs flags field and switch
all callers to it.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
builtin-send-pack.c | 8 +++++++-
http-push.c | 4 ++--
remote.c | 4 ++--
remote.h | 7 +++++++
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index d5ead97..d42164e 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -227,6 +227,12 @@ static int do_send_pack(int in, int out, struct remote *remote, const char *dest
int allow_deleting_refs = 0;
int expect_status_report = 0;
int shown_dest = 0;
+ int flags = MATCH_REFS_NONE;
+
+ if (args.send_all)
+ flags |= MATCH_REFS_ALL;
+ if (args.send_mirror)
+ flags |= MATCH_REFS_MIRROR;
/* No funny business with the matcher */
remote_tail = get_remote_heads(in, &remote_refs, 0, NULL, REF_NORMAL);
@@ -242,7 +248,7 @@ static int do_send_pack(int in, int out, struct remote *remote, const char *dest
if (!remote_tail)
remote_tail = &remote_refs;
if (match_refs(local_refs, remote_refs, &remote_tail,
- nr_refspec, refspec, args.send_all | (args.send_mirror << 1)))
+ nr_refspec, refspec, flags))
return -1;
if (!remote_refs) {
diff --git a/http-push.c b/http-push.c
index 99328f5..66b81f1 100644
--- a/http-push.c
+++ b/http-push.c
@@ -78,7 +78,7 @@ static struct curl_slist *no_pragma_header;
static struct curl_slist *default_headers;
static int push_verbosely;
-static int push_all;
+static int push_all = MATCH_REFS_NONE;
static int force_all;
static int dry_run;
@@ -2300,7 +2300,7 @@ int main(int argc, char **argv)
if (*arg == '-') {
if (!strcmp(arg, "--all")) {
- push_all = 1;
+ push_all = MATCH_REFS_ALL;
continue;
}
if (!strcmp(arg, "--force")) {
diff --git a/remote.c b/remote.c
index 45dd59b..09b7aad 100644
--- a/remote.c
+++ b/remote.c
@@ -726,8 +726,8 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
{
struct refspec *rs =
parse_ref_spec(nr_refspec, (const char **) refspec);
- int send_all = flags & 01;
- int send_mirror = flags & 02;
+ int send_all = flags & MATCH_REFS_ALL;
+ int send_mirror = flags & MATCH_REFS_MIRROR;
if (match_explicit_refs(src, dst, dst_tail, rs, nr_refspec))
return -1;
diff --git a/remote.h b/remote.h
index 6a4c7a0..b10036c 100644
--- a/remote.h
+++ b/remote.h
@@ -102,4 +102,11 @@ struct branch *branch_get(const char *name);
int branch_has_merge_config(struct branch *branch);
int branch_merge_matches(struct branch *, int n, const char *);
+/* Flags to match_refs. */
+enum match_refs_flags {
+ MATCH_REFS_NONE = 0,
+ MATCH_REFS_ALL = (1 << 0),
+ MATCH_REFS_MIRROR = (1 << 1),
+};
+
#endif
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox