Re: Proposal: create meaningful aliases for git reset's hard/soft/mixed

2012-12-17 Thread Martin von Zweigbergk
On Wed, Nov 23, 2011 at 10:51 AM, Junio C Hamano gits...@pobox.com wrote: I am guilty of introducing git reset --soft HEAD^ before I invented commit --amend during v1.3.0 timeframe to solve the issue soft reset originally wanted to. I do use commit --amend a lot, but I still appreciate having

Fwd: [RFC/FR] Should git checkout (-B|-b) branch master...branch work?

2012-12-21 Thread Martin von Zweigbergk
Oops, meant for all of you. -- Forwarded message -- From: Martin von Zweigbergk martinv...@gmail.com Date: Fri, Dec 21, 2012 at 8:45 AM Subject: Re: [RFC/FR] Should git checkout (-B|-b) branch master...branch work? To: Junio C Hamano gits...@pobox.com On Fri, Dec 21, 2012 at 7

[PATCH 1/2] tests: move test_cmp_rev to test-lib-functions

2012-12-21 Thread Martin von Zweigbergk
A function for checking that two given parameters refer to the same revision was defined in several places, so move the definition to test-lib-functions.sh instead. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- t/t1505-rev-parse-last.sh | 18 +- t/t3404

[PATCH 2/2] learn to pick/revert into unborn branch

2012-12-21 Thread Martin von Zweigbergk
, but will result in conflicts unless the specified revision only deletes files. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- The plan is to use this for fixing git rebase --root as discussed in http://thread.gmane.org/gmane.comp.version-control.git/205796 Is there a better way of creating

Re: [PATCH 2/2] learn to pick/revert into unborn branch

2012-12-22 Thread Martin von Zweigbergk
On Sat, Dec 22, 2012 at 7:24 PM, Junio C Hamano gits...@pobox.com wrote: Martin von Zweigbergk martinv...@gmail.com writes: From the user's point of view, it seems natural to think that cherry-picking into an unborn branch should work, so make it work, with or without --ff. I actually am

Re: [PATCH 2/2] learn to pick/revert into unborn branch

2012-12-23 Thread Martin von Zweigbergk
On Sun, Dec 23, 2012 at 11:18 AM, Junio C Hamano gits...@pobox.com wrote: Martin von Zweigbergk martinv...@gmail.com writes: On Sat, Dec 22, 2012 at 7:24 PM, Junio C Hamano gits...@pobox.com wrote: I am not opposed to an internal use of the cherry-pick machinery to implement a corner case

Re: Find the starting point of a local branch

2012-12-24 Thread Martin von Zweigbergk
On Sun, Dec 23, 2012 at 11:31 PM, Woody Wu narkewo...@gmail.com wrote: On Sun, Dec 23, 2012 at 11:09:58PM -0500, Seth Robertson wrote: In message 20121224035825.GA17203@zuhnb712, Woody Wu writes: How can I find out what's the staring reference point (a commit number or tag name) of a

Re: Find the starting point of a local branch

2012-12-27 Thread Martin von Zweigbergk
On Thu, Dec 27, 2012 at 9:15 PM, Woody Wu narkewo...@gmail.com wrote: On Mon, Dec 24, 2012 at 09:24:39AM -0800, Martin von Zweigbergk wrote: On Sun, Dec 23, 2012 at 11:31 PM, Woody Wu narkewo...@gmail.com wrote: This is not working to me since I have more than one local branch

Makefile dependency from 'configure' to 'GIT-VERSION-FILE'

2013-01-01 Thread Martin von Zweigbergk
Hi, I use autoconf with git.git. I have noticed lately, especially when doing things like git rebase -i --exec make, that ./configure is run every time. If I understand correctly, this is because of 8242ff4 (build: reconfigure automatically if configure.ac changes, 2012-07-19). Just a few days

Re: Makefile dependency from 'configure' to 'GIT-VERSION-FILE'

2013-01-01 Thread Martin von Zweigbergk
On Tue, Jan 1, 2013 at 11:21 PM, Jonathan Nieder jrnie...@gmail.com wrote: How about this patch (untested)? Looks good. Thanks! --- a/Makefile +++ b/Makefile @@ -2267,12 +2267,9 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh mv $@+ $@ endif # NO_PYTHON

Re: [PATCH v2] build: do not automatically reconfigure unless configure.ac changed

2013-01-02 Thread Martin von Zweigbergk
diff --git a/Makefile b/Makefile index 26b697d..2f5e2ab 100644 --- a/Makefile +++ b/Makefile @@ -2167,8 +2167,14 @@ configure: configure.ac GIT-VERSION-FILE $(RM) $+ ifdef AUTOCONFIGURED -config.status: configure - $(QUIET_GEN)if test -f config.status; then \ +# We avoid

[PATCH 04/19] reset: don't allow git reset -- $pathspec in bare repo

2013-01-09 Thread Martin von Zweigbergk
--- builtin/reset.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 045c960..664fad9 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -295,8 +295,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix)

[PATCH 02/19] reset $pathspec: exit with code 0 if successful

2013-01-09 Thread Martin von Zweigbergk
git reset $pathspec currently exits with a non-zero exit code if the worktree is dirty after resetting, which is inconsistent with reset without pathspec, and it makes it harder to know whether the command really failed. Change it to exit with code 0 regardless of whether the worktree is dirty so

[PATCH 15/19] reset.c: finish entire cmd_reset() whether or not pathspec is given

2013-01-09 Thread Martin von Zweigbergk
By not returning from inside the if (pathspec) block, we can let the pathspec-aware and pathspec-less code share a bit more, making it easier to make future changes that should affect both cases. This also highlights the similarity between read_from_tree() and reset_index(). --- Should error

[PATCH 05/19] reset.c: extract function for parsing arguments

2013-01-09 Thread Martin von Zweigbergk
Declutter cmd_reset() a bit by moving out the argument parsing to its own function. --- builtin/reset.c | 71 ++--- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 664fad9..9473725 100644

[PATCH 19/19] reset [--mixed]: use diff-based reset whether or not pathspec was given

2013-01-09 Thread Martin von Zweigbergk
Thanks to b65982b (Optimize diff-index --cached using cache-tree, 2009-05-20), resetting with paths is much faster than resetting without paths. Some timings for the linux-2.6 repo to illustrate this (best of five, warm cache): reset reset . real0m0.219s0m0.080s user

[PATCH 10/19] reset --keep: only write index file once

2013-01-09 Thread Martin von Zweigbergk
git reset --keep calls reset_index_file() twice, first doing a two-way merge to the target revision, updating the index and worktree, and then resetting the index. After each call, we write the index file. In the unlikely event that the second call to reset_index_file() fails, the index will have

[PATCH 13/19] reset.c: move lock, write and commit out of update_index_refresh()

2013-01-09 Thread Martin von Zweigbergk
In preparation for the/a following patch, move the locking, writing and committing of the index file out of update_index_refresh(). The code duplication caused will soon be taken care of. What remains of update_index_refresh() is just one line, but it is still called from two places, so let's

[PATCH 09/19] reset.c: replace switch by if-else

2013-01-09 Thread Martin von Zweigbergk
--- builtin/reset.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 42d1563..05ccfd4 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -351,18 +351,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)

[PATCH 01/19] reset $pathspec: no need to discard index

2013-01-09 Thread Martin von Zweigbergk
Since 34110cd (Make 'unpack_trees()' have a separate source and destination index, 2008-03-06), the index no longer gets clobbered by do_diff_cache() and we can remove the code for discarding and re-reading it. There are two paths to update_index_refresh() from cmd_reset(), but on both paths,

[PATCH 00/19] reset improvements

2013-01-09 Thread Martin von Zweigbergk
7.21 [1] http://thread.gmane.org/gmane.comp.version-control.git/210568/focus=210855 Martin von Zweigbergk (19): reset $pathspec: no need to discard index reset $pathspec: exit with code 0 if successful reset.c: pass pathspec around instead of (prefix, argv) pair reset: don't

[PATCH 17/19] reset $sha1 $pathspec: require $sha1 only to be treeish

2013-01-09 Thread Martin von Zweigbergk
Resetting with paths does not update HEAD and there is nothing else that a commit should be needed for. Relax the argument parsing so only a tree is required. The sha1 is only passed to read_from_tree(), which already only requires a tree. The rev variable we pass to run_add_interactive() will

[PATCH 08/19] reset.c: share call to die_if_unmerged_cache()

2013-01-09 Thread Martin von Zweigbergk
Use a single condition to guard the call to die_if_unmerged_cache for both --soft and --keep. This avoids the small distraction of the precondition check from the logic following it. Also change an instance of if (e) err = err || f(); to the almost as short, but clearer if (e !err)

[PATCH 16/19] reset [--mixed] --quiet: don't refresh index

2013-01-09 Thread Martin von Zweigbergk
git reset [--mixed] without --quiet refreshes the index in order to display the Unstaged changes after reset. When --quiet is given, that output is suppressed, removing the need to refresh the index. Other porcelain commands that care about a refreshed index should already be refreshing it, so

[PATCH 07/19] reset.c: extract function for updating {ORIG,}HEAD

2013-01-09 Thread Martin von Zweigbergk
By extracting the code for updating the HEAD and ORIG_HEAD symbolic references to a separate function, we declutter cmd_reset() a bit and we make it clear that e.g. the four variables {,sha1_}{,old_}orig are only used by this code. --- builtin/reset.c | 39 +++

[PATCH 06/19] reset.c: remove unnecessary variable 'i'

2013-01-09 Thread Martin von Zweigbergk
Throughout most of parse_args(), the variable 'i' remains at 0. In the remaining few cases, we can do pointer arithmentic on argv itself instead. --- This is clearly mostly a matter of taste. The remainder of the series does not depend on it in any way. builtin/reset.c | 29

[PATCH 03/19] reset.c: pass pathspec around instead of (prefix, argv) pair

2013-01-09 Thread Martin von Zweigbergk
We use the path arguments in two places in reset.c: in interactive_reset() and read_from_tree(). Both of these call get_pathspec(), so we pass the (prefix, arv) pair to both functions. Move the call to get_pathspec() out of these methods, for two reasons: 1) One argument is simpler than two. 2) It

[PATCH 11/19] reset: avoid redundant error message

2013-01-09 Thread Martin von Zweigbergk
If writing or committing the new index file fails, we print Could not write new index file. followed by Could not reset index file to revision $rev.. The first message seems to imply the second, so print only the first message. --- builtin/reset.c | 8 +++- 1 file changed, 3 insertions(+), 5

[PATCH 18/19] reset: allow reset on unborn branch

2013-01-09 Thread Martin von Zweigbergk
Some users seem to think, knowingly or not, that being on an unborn branch is like having a commit with an empty tree checked out, but when run on an unborn branch, git reset currently fails with: fatal: Failed to resolve 'HEAD' as a valid ref. Instead of making users figure out that they

[PATCH 12/19] reset.c: move update_index_refresh() call out of read_from_tree()

2013-01-09 Thread Martin von Zweigbergk
The final part of cmd_reset() essentially looks like: if (pathspec) { ... read_from_tree(...); } else { ... reset_index(...); update_index_refresh(...); ... } where read_from_tree() internally also calls update_index_refresh(). Move the call to

Re: [PATCH 16/19] reset [--mixed] --quiet: don't refresh index

2013-01-09 Thread Martin von Zweigbergk
On Wed, Jan 9, 2013 at 9:01 AM, Jeff King p...@peff.net wrote: On Wed, Jan 09, 2013 at 12:16:13AM -0800, Martin von Zweigbergk wrote: git reset [--mixed] without --quiet refreshes the index in order to display the Unstaged changes after reset. When --quiet is given, that output is suppressed

Re: [PATCH 16/19] reset [--mixed] --quiet: don't refresh index

2013-01-09 Thread Martin von Zweigbergk
On Wed, Jan 9, 2013 at 11:12 AM, Junio C Hamano gits...@pobox.com wrote: Martin von Zweigbergk martinv...@gmail.com writes: And as a Porcelain, I would rather expect it to leave the resulting index refreshed. Yeah, I guess you're right. Regular users (those using only porcelain) shouldn't

Re: [PATCH 04/19] reset: don't allow git reset -- $pathspec in bare repo

2013-01-10 Thread Martin von Zweigbergk
On Wed, Jan 9, 2013 at 11:32 AM, Junio C Hamano gits...@pobox.com wrote: Martin von Zweigbergk martinv...@gmail.com writes: --- builtin/reset.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) With the patch that does not have any explicit check for bareness nor new error

Re: [PATCH 08/19] reset.c: share call to die_if_unmerged_cache()

2013-01-10 Thread Martin von Zweigbergk
On Wed, Jan 9, 2013 at 11:48 AM, Junio C Hamano gits...@pobox.com wrote: Martin von Zweigbergk martinv...@gmail.com writes: Use a single condition to guard the call to die_if_unmerged_cache for both --soft and --keep. This avoids the small distraction of the precondition check from the logic

Re: [PATCH 02/21] Add parse_pathspec() that converts cmdline args to struct pathspec

2013-01-10 Thread Martin von Zweigbergk
On Sat, Jan 5, 2013 at 10:20 PM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: + + /* No arguments, no prefix - no pathspec */ + if (!entry !prefix) + return; + /* No arguments with prefix - prefix pathspec */ When working with the old get_pathspec(), I

Re: [PATCH 09/19] reset.c: replace switch by if-else

2013-01-10 Thread Martin von Zweigbergk
On Wed, Jan 9, 2013 at 11:53 AM, Junio C Hamano gits...@pobox.com wrote: Martin von Zweigbergk martinv...@gmail.com writes: --- builtin/reset.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 42d1563..05ccfd4 100644

Re: [PATCH v2 05/21] commit: convert to use parse_pathspec

2013-01-12 Thread Martin von Zweigbergk
On Fri, Jan 11, 2013 at 3:20 AM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: diff --git a/cache.h b/cache.h index e52365d..a3c316f 100644 --- a/cache.h +++ b/cache.h @@ -476,6 +476,9 @@ extern int ie_modified(const struct index_state *, struct cache_entry *, struct /* Pathspec magic */

Re: [PATCH v3 03/31] Add parse_pathspec() that converts cmdline args to struct pathspec

2013-01-13 Thread Martin von Zweigbergk
On Sun, Jan 13, 2013 at 4:35 AM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: +static void parse_pathspec(struct pathspec *pathspec, + unsigned magic_mask, unsigned flags, + const char *prefix, const char **argv) +{ + struct

Re: [PATCH] builtin/reset.c: Fix a sparse warning

2013-01-14 Thread Martin von Zweigbergk
On Mon, Jan 14, 2013 at 11:28 AM, Ramsay Jones ram...@ramsay1.demon.co.uk wrote: In particular, sparse issues an symbol not declared. Should it be static? warning for the 'parse_args' function. Since this function does not require greater than file visibility, we suppress this warning by

[PATCH v2 03/19] reset.c: pass pathspec around instead of (prefix, argv) pair

2013-01-14 Thread Martin von Zweigbergk
) It lets us use the (arguably clearer) if (pathspec) in place of if (i argc). Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 27 ++- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index

[PATCH v2 04/19] reset: don't allow git reset -- $pathspec in bare repo

2013-01-14 Thread Martin von Zweigbergk
changes after reset: D .gitattributes D .gitignore D .mailmap ... This happens because the check for is_bare_repository() happens after we branch off into read_from_tree() to reset with paths. Fix by moving the branching point after the check. Signed-off-by: Martin von

[PATCH v2 01/19] reset $pathspec: no need to discard index

2013-01-14 Thread Martin von Zweigbergk
0m0.040s0m0.020s sys 0m0.050s0m0.050s Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 16 +--- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 915cc9f..8cc7c72 100644 --- a/builtin

[PATCH v2 02/19] reset $pathspec: exit with code 0 if successful

2013-01-14 Thread Martin von Zweigbergk
that non-zero indicates an error. This makes the 4 disambiguation test cases in t7102 clearer since they all used to fail, 3 of which failed due to changes in the work tree. Now only the ambiguous one fails. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c

[PATCH v2 17/19] reset $sha1 $pathspec: require $sha1 only to be treeish

2013-01-14 Thread Martin von Zweigbergk
() will resolve to a tree. This is fine since interactive_reset only needs the parameter to be a treeish and doesn't use it for display purposes. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 48 +++- t/t7102-reset.sh | 8

[PATCH v2 19/19] reset [--mixed]: use diff-based reset whether or not pathspec was given

2013-01-14 Thread Martin von Zweigbergk
). Timing git reset shows that it indeed becomes as fast as git reset . after this patch. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- It seems like a better solution would be for unpack_trees() learn the same tricks as do_diff_cache(). I'm leaving that a challange for the reader

[PATCH v2 18/19] reset: allow reset on unborn branch

2013-01-14 Thread Martin von Zweigbergk
. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c| 16 - t/t7106-reset-unborn-branch.sh | 52 ++ 2 files changed, 62 insertions(+), 6 deletions(-) create mode 100755 t/t7106-reset-unborn-branch.sh diff

[PATCH v2 15/19] reset.c: finish entire cmd_reset() whether or not pathspec is given

2013-01-14 Thread Martin von Zweigbergk
von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 42 ++ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index e8a3e41..c316d9b 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -309,19 +309,6

[PATCH v2 13/19] reset.c: move lock, write and commit out of update_index_refresh()

2013-01-14 Thread Martin von Zweigbergk
leave it for now. In the process, we expose and fix the minor UI bug that makes us print Could not refresh index when we fail to write the index file when invoked with a pathspec. Copy the error message from the pathspec-less codepath (Could not write new index file.). Signed-off-by: Martin von

[PATCH v2 10/19] reset: avoid redundant error message

2013-01-14 Thread Martin von Zweigbergk
If writing or committing the new index file fails, we print Could not write new index file. followed by Could not reset index file to revision $rev.. The first message seems to imply the second, so print only the first message. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com

[PATCH v2 14/19] reset [--mixed]: only write index file once

2013-01-14 Thread Martin von Zweigbergk
-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index c1d6ef2..e8a3e41 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -336,6 +336,11 @@ int cmd_reset(int

[PATCH v2 05/19] reset.c: extract function for parsing arguments

2013-01-14 Thread Martin von Zweigbergk
Declutter cmd_reset() a bit by moving out the argument parsing to its own function. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 70 +++-- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git

[PATCH v2 11/19] reset.c: replace switch by if-else

2013-01-14 Thread Martin von Zweigbergk
-overs. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 97fa9f7..c3eb2eb 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -349,18 +349,11

[PATCH v2 16/19] reset.c: inline update_index_refresh()

2013-01-14 Thread Martin von Zweigbergk
Now that there is only one caller left to the single-line method update_index_refresh(), inline it. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c

[PATCH v2 07/19] reset.c: extract function for updating {ORIG_,}HEAD

2013-01-14 Thread Martin von Zweigbergk
By extracting the code for updating the HEAD and ORIG_HEAD symbolic references to a separate function, we declutter cmd_reset() a bit and we make it clear that e.g. the four variables {,sha1_}{,old_}orig are only used by this code. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com

[PATCH v2 09/19] reset --keep: only write index file once

2013-01-14 Thread Martin von Zweigbergk
state. As a bonus, we speed up git reset --keep a little on the linux-2.6 repo (best of five, warm cache): Before After real0m0.315s0m0.296s user0m0.290s0m0.280s sys 0m0.020s0m0.010s Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c

[PATCH v2 00/19] reset improvements

2013-01-14 Thread Martin von Zweigbergk
update_index_refresh() - Incorporated fixes from Junio's repo - Provided some motivation for replace switch by if-else amd moved the patch later in the series. Thanks for reviewing! Martin von Zweigbergk (19): reset $pathspec: no need to discard index reset $pathspec: exit with code 0

[PATCH v2 12/19] reset.c: move update_index_refresh() call out of read_from_tree()

2013-01-14 Thread Martin von Zweigbergk
() out of read_from_tree for symmetry with the 'else' block, making read_from_tree() and reset_index() closer in functionality. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git

[PATCH v2 08/19] reset.c: share call to die_if_unmerged_cache()

2013-01-14 Thread Martin von Zweigbergk
) err = f(); (which is equivalent since we only care whether exit code is 0) Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- builtin/reset.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 2187d64..4e34195

[PATCH v2 06/19] reset.c: remove unnecessary variable 'i'

2013-01-14 Thread Martin von Zweigbergk
of a loop. To avoid such confusion, remove the variable and also the 'argc' parameter and check for NULL trailing argv instead. Signed-off-by: Martin von Zweigbergk martinv...@gmail.com --- I explained a bit more why I was confused by the current style, but I'm also perfectly happy if you just drop

Re: [PATCH v2 06/19] reset.c: remove unnecessary variable 'i'

2013-01-15 Thread Martin von Zweigbergk
I suppose this was meant for everyone. Adding back the others. On Tue, Jan 15, 2013 at 10:27 AM, Holding, Lawrence (NZ) lawrence.hold...@cubic.com wrote: Maybe use *argv instead of argv[0]? Sure. Everywhere? Also in the lines added in patch 17/19 that refer to both argv[0] and argv[1], such as

[PATCH v2 17/19] fixup! reset $sha1 $pathspec: require $sha1 only to be treeish

2013-01-16 Thread Martin von Zweigbergk
--- Sorry, I forgot the documentation updates. I hope this looks ok. Can you squash this in, Junio? Thanks. I don't think any documentation update is necessary for the reset on unborn branch patch. Let me know if you think differently. Documentation/git-reset.txt | 18 +-

Re: [PATCH v2 17/19] fixup! reset $sha1 $pathspec: require $sha1 only to be treeish

2013-01-16 Thread Martin von Zweigbergk
On Wed, Jan 16, 2013 at 10:00 AM, Martin von Zweigbergk martinv...@gmail.com wrote: --- Sorry, I forgot the documentation updates. I hope this looks ok. Can you squash this in, Junio? Thanks. I see the series just entered 'next', so I guess it would have to go on top then. Perhaps

Re: [RFC] git rm -u

2013-01-20 Thread Martin von Zweigbergk
On Sun, Jan 20, 2013 at 1:27 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: Matthieu Moy matthieu@grenoble-inp.fr writes: git add -u is one of the only exceptions (with git grep). I consider this as a bug, and think this should be changed. This has

Re: [PATCH v3 08/31] parse_pathspec: add PATHSPEC_EMPTY_MATCH_ALL

2013-01-21 Thread Martin von Zweigbergk
Hi, I was tempted to ask this before, and the recent thread regarding add -u/A [1] convinced me to. On Sun, Jan 13, 2013 at 4:35 AM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: We have two ways of dealing with empty pathspec: 1. limit it to current prefix 2. match the entire working

Re: [PATCH 1/3] git-am: record full index line in the patch used while rebasing

2013-01-31 Thread Martin von Zweigbergk
On Thu, Jan 31, 2013 at 8:32 PM, Junio C Hamano gits...@pobox.com wrote: Earlier, a230949 (am --rebasing: get patch body from commit, not from mailbox, 2012-06-26) learned to regenerate patch body from the commit object while rebasing, instead of reading from the rebase-am front-end. While

Re: [PATCH] rebase --preserve-merges keeps empty merge commits

2013-02-01 Thread Martin von Zweigbergk
I'm working on a re-roll of http://thread.gmane.org/gmane.comp.version-control.git/205796 and finally got around to including test cases for what you fixed in this patch. I want to make sure I'm testing what you fixed here. See questions below. On Sat, Jan 12, 2013 at 12:46 PM, Phil Hord

Re: [PATCH] rebase --preserve-merges keeps empty merge commits

2013-02-02 Thread Martin von Zweigbergk
On Fri, Feb 1, 2013 at 1:05 PM, Phil Hord ho...@cisco.com wrote: This is probably right, but it is not exactly the case that caused my itch. I think my branch looked like [...] That also makes sense. I'll add tests for both cases. Your patch makes both of them pass. # a---b---c # \ \

Re: `git checkout --orpan` leaves a dirty worktree

2013-02-08 Thread Martin von Zweigbergk
I'm curious what your use case is. The behavior has been inconvenient for me too, but I have only used it in test cases; I have no real use case where I wanted to create an unborn/orphan branch. On Fri, Feb 8, 2013 at 11:50 AM, Ramkumar Ramachandra artag...@gmail.com wrote: Hi, Why should I

Re: [PATCH v8 4/4] git-rebase: add keep_empty flag

2012-07-18 Thread Martin von Zweigbergk
On Fri, Apr 20, 2012 at 7:36 AM, Neil Horman nhor...@tuxdriver.com wrote: pick_one () { ff=--ff + case $1 in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac case $force_rebase in '') ;; ?*) ff= ;; esac output git rev-parse --verify $sha1 || die Invalid commit name:

Re: [PATCH v8 4/4] git-rebase: add keep_empty flag

2012-07-18 Thread Martin von Zweigbergk
On Wed, Jul 18, 2012 at 12:10 AM, Johannes Sixt j.s...@viscovery.net wrote: Am 7/18/2012 8:20, schrieb Martin von Zweigbergk: On Fri, Apr 20, 2012 at 7:36 AM, Neil Horman nhor...@tuxdriver.com wrote: pick_one () { ff=--ff + case $1 in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac

[PATCH 3/7] git-rebase--interactive: group all $preserve_merges code

2012-07-18 Thread Martin von Zweigbergk
The code in git-rebase--interactive that creates the todo file contains if-blocks that depend on whether $preserve_merges is active. There is only a very small amount of code in between that is shared with non-merge-preserving code path, so remove the repeated conditions and duplicate the small

[PATCH 2/7] git-rebase--interactive.sh: extract function for adding pick line

2012-07-18 Thread Martin von Zweigbergk
Extract the code that adds a possibly commented-out pick line to the todo file. This lets us reuse it more easily later. --- git-rebase--interactive.sh | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/git-rebase--interactive.sh

[PATCH 5/7] rebase -p: use --cherry-mark for todo file

2012-07-18 Thread Martin von Zweigbergk
While building the todo file, 'rebase -p' needs to find the cherry-picked commits in the branch that is about to be rebased. For this, it calculates the set difference between the full set of commits and the non-cherry-picked ones (as reported by 'git rev-list --left-right --cherry-pick'). Now

[PATCH 6/7] rebase -p: don't request --left-right only to ignore left side

2012-07-18 Thread Martin von Zweigbergk
While generating the todo file, rebase -p calls 'git rev-list --left-right a...b' (with 'a' equal to $upstream or $onto and 'b' equal to $orig_head) and its output is piped through 'sed -n s/^//p', making it equivalent to 'git rev-list --right-only a...b'. Change the invocation to exactly that.

[PATCH 4/7] git-rebase--interactive.sh: look up subject in add_pick_line

2012-07-18 Thread Martin von Zweigbergk
The todo file is generated using (more-or-less) 'git rev-list $revisions --pretty=oneline --abbrev-commit --abbrev=7', i.e. by letting 'git rev-list' output both the abbreviated sha1 and the subject line. To allow us to more easily generate the list of commits to rebase by using commands that

[PATCH 0/7] correctly calculate patches to rebase

2012-07-18 Thread Martin von Zweigbergk
These seven patches replace the broken one I sent in http://thread.gmane.org/gmane.comp.version-control.git/200644/focus=200648. I hope I got the handling of empty commits right this time. Martin von Zweigbergk (7): git-rebase--am.sh: avoid special-casing --keep-empty git-rebase

[PATCH 7/7] rebase (without -p): correctly calculate patches to rebase

2012-07-18 Thread Martin von Zweigbergk
. As a side-effect, we also avoid the cost of formatting patches. Test case updates for 'rebase -m' by Knut, the rest by Martin. [1] http://thread.gmane.org/gmane.comp.version-control.git/161917 Helped-by: Knut Franke knut.fra...@gmx.de Signed-off-by: Martin von Zweigbergk martin.von.zweigbe

Re: [PATCH 0/7] correctly calculate patches to rebase

2012-07-18 Thread Martin von Zweigbergk
Argh! Sorry about the sendemail.chainreplyto=true. I must have read that warning message incorrectly :-(. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH 1/7] git-rebase--am.sh: avoid special-casing --keep-empty

2012-07-18 Thread Martin von Zweigbergk
Since 0fbb95d (am: don't call mailinfo if $rebasing, 2012-06-26), the patch body to apply when running 'git am --rebasing' is not taken from the mbox, but directly from the commit. If such a commit is empty, 'git am --rebasing' still happily applies it and commits. However, since the input to 'git

Re: [PATCH 4/7] git-rebase--interactive.sh: look up subject in add_pick_line

2012-07-20 Thread Martin von Zweigbergk
Thanks for reviewing. On Fri, Jul 20, 2012 at 1:14 AM, Johannes Sixt j.s...@viscovery.net wrote: Am 7/18/2012 9:27, schrieb Martin von Zweigbergk: @@ -814,7 +814,8 @@ add_pick_line () { else comment_out= fi - printf '%s\n' ${comment_out}pick $1 $2 $todo

Re: [PATCH 7/7] rebase (without -p): correctly calculate patches to rebase

2012-07-20 Thread Martin von Zweigbergk
On Fri, Jul 20, 2012 at 1:18 AM, Johannes Sixt j.s...@viscovery.net wrote: Am 7/18/2012 9:27, schrieb Martin von Zweigbergk: diff --git a/git-rebase--am.sh b/git-rebase--am.sh index 37c1b23..fe3fdd1 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -16,11 +16,9 @@ skip

Re: [PATCH v3 6/7] Remove unused and bad gettext block from git-am

2012-07-24 Thread Martin von Zweigbergk
On Tue, Jul 24, 2012 at 11:27 AM, Jonathan Nieder jrnie...@gmail.com wrote: Hi, Jiang Xin wrote: Gettext message should not start with '-' nor '--'. Since the '-d' and '--dotest' options do not exist in OPTIONS_SPEC variable, it's safe to remove the block. The above justification is not a

Re: What's cooking in git.git (Jul 2012, #08; Thu, 26)

2012-07-27 Thread Martin von Zweigbergk
On Thu, Jul 26, 2012 at 11:09 PM, Junio C Hamano gits...@pobox.com wrote: * mz/rebase-range (2012-07-18) 7 commits - rebase (without -p): correctly calculate patches to rebase - rebase -p: don't request --left-right only to ignore left side - rebase -p: use --cherry-mark for todo file -

[PATCH 1/2] remove unnecessary parameter from get_patch_ids()

2012-07-27 Thread Martin von Zweigbergk
rev_info. Signed-off-by: Martin von Zweigbergk martin.von.zweigbe...@gmail.com --- builtin/log.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index ecc2793..7a92e3f 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -696,7 +696,7 @@ static int

Re: [PATCH 2/2] log: remove redundant check for merge commit

2012-07-27 Thread Martin von Zweigbergk
On Fri, Jul 27, 2012 at 3:30 PM, Junio C Hamano gits...@pobox.com wrote: Martin von Zweigbergk martin.von.zweigbe...@gmail.com writes: Also re-initializing rev_info fields to the same values already set in init_revisions(). Oops, that should have been _avoid_ re-initializing. I suspect

Re: [PATCH 2/2] log: remove redundant check for merge commit

2012-07-28 Thread Martin von Zweigbergk
Sorry, I meant to CC the list. See below. On Sat, Jul 28, 2012 at 9:56 PM, Martin von Zweigbergk martin.von.zweigbe...@gmail.com wrote: On Fri, Jul 27, 2012 at 11:52 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: It seems to have some interaction

[PATCH v2 2/3] cherry: don't set ignored rev_info options

2012-07-29 Thread Martin von Zweigbergk
), these options are just distractions, so remove them. Signed-off-by: Martin von Zweigbergk martin.von.zweigbe...@gmail.com --- builtin/log.c | 4 1 file changed, 4 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 7a92e3f..8cea1e5 100644 --- a/builtin/log.c +++ b/builtin/log.c

[PATCH v2 1/3] remove unnecessary parameter from get_patch_ids()

2012-07-29 Thread Martin von Zweigbergk
. Signed-off-by: Martin von Zweigbergk martin.von.zweigbe...@gmail.com --- builtin/log.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index ecc2793..7a92e3f 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -696,7 +696,7 @@ static int

[PATCH v2 0/3] Small log simplifications

2012-07-29 Thread Martin von Zweigbergk
Separated out the removal of the unused diff options into patch 2/3 and added the necessary max_parents=1 in patch 3/3. Martin von Zweigbergk (3): remove unnecessary parameter from get_patch_ids() cherry: don't set ignored rev_info options log: remove redundant check for merge commit

[PATCH v2 3/3] log: remove redundant check for merge commit

2012-07-29 Thread Martin von Zweigbergk
While walking the revision list in get_patch_ids and cmd_cherry, we check for each commit if there is more than one parent and ignore the commit if that is the case. Instead, set rev_info.max_parents to 1 and let the revision traversal code handle it for us. Signed-off-by: Martin von Zweigbergk

Re: [PATCH 1/7] am: suppress error output from a conditional

2013-04-23 Thread Martin von Zweigbergk
On Tue, Apr 23, 2013 at 7:01 AM, Ramkumar Ramachandra artag...@gmail.com wrote: When testing if the $dotest directory exists, and if $next is greater than $last When can that happen? If one edits the todo? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message

Re: [PATCH 2/7] rebase -i: don't error out if $state_dir already exists

2013-04-23 Thread Martin von Zweigbergk
On Tue, Apr 23, 2013 at 7:01 AM, Ramkumar Ramachandra artag...@gmail.com wrote: Practically speaking, the only reason why a `mkdir $state_dir` would fail is because $state_dir already exists. Would we ever get to this point in the code if it already exists? Also, I had the feeling that the

Re: [PATCH 5/7] rebase -i: return control to the caller, for housekeeping

2013-04-23 Thread Martin von Zweigbergk
On Tue, Apr 23, 2013 at 7:02 AM, Ramkumar Ramachandra artag...@gmail.com wrote: diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index cc3a9a7..9514e31 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -597,7 +597,7 @@ do_next () {

Re: [PATCH] rebase: use reflog to find common base with upstream

2013-10-20 Thread Martin von Zweigbergk
On Wed, Oct 16, 2013 at 11:53 AM, John Keeping j...@keeping.me.uk wrote: Commit 15a147e (rebase: use @{upstream} if no upstream specified, 2011-02-09) says: Make it default to 'git rebase @{upstream}'. That is also what 'git pull [--rebase]' defaults to, so it only makes sense

Re: [PATCH] rebase: use reflog to find common base with upstream

2013-10-21 Thread Martin von Zweigbergk
On Wed, Oct 16, 2013 at 11:53 AM, John Keeping j...@keeping.me.uk wrote: Commit 15a147e (rebase: use @{upstream} if no upstream specified, 2011-02-09) says: Make it default to 'git rebase @{upstream}'. That is also what 'git pull [--rebase]' defaults to, so it only makes sense

Re: [PATCH] rebase: use reflog to find common base with upstream

2013-10-22 Thread Martin von Zweigbergk
On Mon, Oct 21, 2013 at 4:24 AM, John Keeping j...@keeping.me.uk wrote: On Sun, Oct 20, 2013 at 10:03:29PM -0700, Martin von Zweigbergk wrote: On Wed, Oct 16, 2013 at 11:53 AM, John Keeping j...@keeping.me.uk wrote: Commit 15a147e (rebase: use @{upstream} if no upstream specified, 2011-02-09

Re: Re* Bug report: reset -p HEAD

2013-10-24 Thread Martin von Zweigbergk
Sorry about the regression and thanks for report and fixes. On Thu, Oct 24, 2013 at 9:24 PM, Jeff King p...@peff.net wrote: On Thu, Oct 24, 2013 at 08:40:13PM -0700, Junio C Hamano wrote: Maarten de Vries maar...@de-vri.es writes: Some more info: It used to work as intended. Using a bisect

Re: [PATCH v3 2/2] merge-base: teach --fork-point mode

2013-10-25 Thread Martin von Zweigbergk
Thanks for taking care of this! Maybe John or I can finally get the changes to rebase done after this. A few comments below. Sorry I didn't find time to review the earlier revisions. On Fri, Oct 25, 2013 at 2:38 PM, Junio C Hamano gits...@pobox.com wrote: + +where `origin/master` used to point

Re: [PATCH 16/16] add: avoid yoda conditions

2013-10-31 Thread Martin von Zweigbergk
I was recently confused by the yoda condition in this block of code from [1] + for (i = 0; i revs.nr; i++) + if (bases-item-object == revs.commit[i]-object) + break; /* found */ + if (revs.nr = i) I think I was particularly surprised because it came so soon after the i revs.nr. I didn't bother

Re: [RFC/PATCH] rebase: use reflog to find common base with upstream

2013-12-08 Thread Martin von Zweigbergk
On Sun, Dec 8, 2013 at 12:06 PM, John Keeping j...@keeping.me.uk wrote: Commit 15a147e (rebase: use @{upstream} if no upstream specified, 2011-02-09) says: Make it default to 'git rebase @{upstream}'. That is also what 'git pull [--rebase]' defaults to, so it only makes sense

<    1   2   3   >