Re: fix french translation
乙酸鋰 ch3co...@gmail.com writes: Sorry, I reversed the revisions. This one should be correct. Yes, it is. But your patch is still not in the form expected by Documentation/SubmittingPatches (missing sign-off-by, and incorrect commit message). The good news is: this is already fixed in git-gui's repo, it will land in git.git next time Junio pulls from it: http://repo.or.cz/w/git-gui.git/commitdiff/ab571ef02f5fc0d08bf2dce4e455d324e40fb220 -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- 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
Re: git-svn too slow, contacts upstream svn repo
- Original Message - From: Quark unixuser2000-f...@yahoo.com To: Git List git@vger.kernel.org Cc: Sent: Monday, 27 May 2013 8:55 PM Subject: git-svn too slow, contacts upstream svn repo hello list, I have been using git-svn in an corporate environment where svn repo has lot of branches, (lot means 100). To avoid cloning all branches my config looks as below [svn-remote svn] url = svn+ssh://url fetch = srcroot/trunk:refs/remotes/trunk branches = srcroot/branches/{branch_1, branch_2, branch_3}:refs/remotes/* Now, when a new branch of my interest is added in svn repo, I had like it to be in my git-repo as well. In an ideal world, one shall simply add that branch name to list in curly braces above, but that does not work. I had love to be proved wrong here. Somebody on stackoverflow.com suggested (to else's question, not mine) to add one more fetch as show below. [svn-remote svn] url = svn+ssh://url fetch = srcroot/trunk:refs/remotes/trunk fetch = srcroot/branch_4:refs/remotes/* # NEW BRANCH branches = srcroot/branches/{branch_1, branch_2, branch_3}:refs/remotes/* haven't tried it, neither do I like it. I do have a solution which WORKS, it is modified version of an example from \doc\git\html\git-svn.html page. Below I have pasted the example and modified it to reflect my specifics. # assume an existing git-svn repo D:\sourcecode # Clone locally - make sure the refs/remotes/ space matches the server mkdir project cd project git init git remote add origin file:///D:/sourcecode # file:// is delibrate, want true n/w behaviour git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*' git fetch # Prevent fetch/pull from local git repo, # we only want to use git svn for form here git config --remove-section remote.origin # Create a local branch from one of the branches just fetched git checkout -b master FETCH_HEAD # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server) git svn init http://svn.example.com/project # edit config to include newly added branch in curly braces # Pull the latest changes from Subversion git svn fetch -r recentish rev, say BEGIN:HEAD Above works exactly as I want, except the last step of git-svn fetch connects to svn repo for each revision from BEGIN to HEAD. I want fairly long history (for pretty blame). Which implies my BEGIN is not so recentish adterall. Hence, it takes awfully long to finish, 2 days typically. When GIT_TRACE is 1, below is output received trace: exec: 'git-svn' 'fetch' trace: run_command: 'git-svn' 'fetch' trace: built-in: git 'config' '--bool' '--get' 'svn.fetchall' trace: built-in: git 'config' '--bool' '--get' 'svn.parent' trace: built-in: git 'config' '--bool' '--get' 'svn.noauthcache' trace: built-in: git 'config' '--get' 'svn.revision' trace: built-in: git 'config' '--bool' '--get' 'svn.nocheckout' trace: built-in: git 'config' '--get' 'svn.authorsprog' trace: built-in: git 'config' '--bool' '--get' 'svn.followparent' trace: built-in: git 'config' '--get' 'svn.authorsfile' trace: built-in: git 'config' '--bool' '--get' 'svn.useSvmProps' trace: built-in: git 'config' '--get' 'svn.username' trace: built-in: git 'config' '--get' 'svn.repackflags' trace: built-in: git 'config' '--bool' '--get' 'svn.localtime' trace: built-in: git 'config' '--int' '--get' 'svn.repack' trace: built-in: git 'config' '--get' 'svn.ignorepaths' trace: built-in: git 'config' '--int' '--get' 'svn.logwindowsize' trace: built-in: git 'config' '--bool' '--get' 'svn.quiet' trace: built-in: git 'config' '--get' 'svn.ignorerefs' trace: built-in: git 'config' '--get' 'svn.configdir' trace: built-in: git 'config' '--bool' '--get' 'svn.addauthorfrom' trace: built-in: git 'config' '--bool' '--get' 'svn.useSvnsyncProps' trace: built-in: git 'config' '--bool' '--get' 'svn.noMetadata' trace: built-in: git 'config' '--bool' '--get' 'svn.uselogauthor' trace: built-in: git 'rev-parse' '--symbolic' '--all' trace: built-in: git 'config' '-l' trace: built-in: git 'config' '-l' trace: built-in: git 'config' '--bool' 'svn.useSvmProps' trace: built-in: git 'config' '-l' trace: built-in: git 'config' 'svn-remote.svn.branches-maxRev' '524908' trace: built-in: git 'rev-list' '--pretty=raw' '--reverse' '9f1414be94ab007b62ace31bf4d210a069276127..refs/remotes/branch_1' '--' trace: built-in: git 'rev-list' '--pretty=raw' '--reverse' '5eb0a454bcf066a8199b851add9ec07cde80119d..refs/remotes/branch_2' '--' trace: built-in: git 'rev-list' '--pretty=raw' '--reverse' '383b68b8514010a71efe10821e5ccc3541903ceb..refs/remotes/branch_3' '--' trace: built-in: git 'rev-list' '--pretty=raw' '--reverse'
Re: [PATCH] fast-import: Remove redundant assignment of 'oe' to itself.
Stefano Lattarini wrote: On 05/26/2013 10:05 PM, Stefan Beller wrote: Reported by cppcheck. Signed-off-by: Stefan Beller stefanbel...@googlemail.com --- fast-import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast-import.c b/fast-import.c index 5f539d7..0142e3a 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2914,7 +2914,7 @@ static void cat_blob(struct object_entry *oe, unsigned char sha1[20]) static void parse_cat_blob(void) { const char *p; - struct object_entry *oe = oe; This was done on purpose, to avoid spurious warnings with (at least) some versions of GCC. + struct object_entry *oe; unsigned char sha1[20]; /* cat-blob SP object LF */ This strange construct has been removed in other places meanwhile. It is violating C-standards (C89, C99) and as such causes warnings with other compilers, so this is fighting fire with fire. As it is a pointer it may be more sensible to initialize with NULL, should appease all compilers and still be correct. Bye, Jojo -- 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
Re: git-send-email doesn't deal with quoted names
On Tue, May 28, 2013 at 01:40:20AM +0200, Jason A. Donenfeld wrote: My commit author name is Jason A. Donenfeld. Because this has a dot, SMTP handling likes to put it in quotes. git-send-email has this line: if (defined $author and $author ne $sender) { With my name, this always winds up false, because it's comparing 'Jason A. Donenfeld ja...@zx2c4.com' with 'Jason A. Donenfeld ja...@zx2c4.com'. So, the logic needs to be fixed somehow. There was a patch for this recently, although it appears to be still under discussion: http://article.gmane.org/gmane.comp.version-control.git/225247 -- 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
Re: [PATCH] git clone depth of 0 not possible.
Hi Junio, I'm interested in getting a fetch tip commit only feature into git, I'll probably look into creating a patch for this. Sounds buggy. Would anything break if we were to make --depth=1 mean 1 deep, including the tip commit? As long as we do not change the meaning of the shallow count going over the wire (i.e. the number we receive from the user will be fudged, so that user's depth 1 that used to mean the tip and one behind it is expressed as depth 2 at the end-user level, and we send over the wire the number that corresponded to the old depth 1), I do not think anything will break, and then --depth=0 may magically start meaning only the tip; its immediate parents will not be transferred and recorded as the shallow boundary in the receiving repository. I'd rather we reserve 0 for unlimited fetch, something we haven't done so far [1]. And because unlimited clone with --depth does not make sense, --depth=0 should be rejected by git-clone. I actually was thinking about changing --depth=1 to mean the tip, with zero commits behind it (and that was consistent with my description of fudging), but ended up saying --depth=0 by mistake. I too think --depth=0 or --depth0 does not make sense, so we are in agreement. Did you consider how to implement this? Looking at the code, it seems the deepen parameter in the wire protocol now means: - 0: Do not change anything about the shallowness (i.e., fetch everything from the shallow root to the tip). - 0: Create new shallow commits at depth commits below the tip (so depth == 1 means tip and one below). - INFINITE_DEPTH (0x7fff): Remove all shallowness and fetch complete history. Given this, I'm not sure how one can express fetch the tip and nothing below that, since depth == 0 already has a different meaning. Of course, one could using depth == 1 in this case to receive two commits and then drop one, but this would seem a bit pointless to me (especially if the commit below the tip is very different from the tip leading to a lot of useless data transfer). Or did I misunderstand something here? Gr. Matthijs -- 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
Feature-request: Ordering `git log --graph` based on *author's* timestamp
I use a fairly complex `git-log` command involving `--date-order` to get an overview of my repository's status; but unfortunately, `--date-order` seems to use the *committer* date, not the *author* date. That means that each time I bring my topic branches up to date by rebasing them onto the current upstream, I lose the helpful chronological ordering in my `git-log` of relative commits in my topic branches (that is, each branch becomes a single long line, because all of its commits got rebased to sequential and nearly-identical committer timestamps.) After a bit of activity on [a Stack Overflow question][1], I've realized that this is basically impossible without 1. dumping `git log`'s `--graph` feature *entirely*, and writing a very complex custom system to order and re-graph commits, or 2. getting `git log` **itself** patched to support an `--author-order` flag or something. (I've never posted here before, forgive me if this is the wrong way to go about this … the #git channel on Freenode pointed me here. :) [1]: http://stackoverflow.com/questions/8576503/how-can-i-make-git-log-order-based-on-authors-timestamp -- 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
Re: [QUERY] How do you sort completions?
Hi, On Fri, May 24, 2013 at 08:11:00AM -0500, Felipe Contreras wrote: AFAIK bash needs the completions sorted, so we added some | sort | uniq. Actually, it seems to sort and remove duplicates automatically: $ _foo () { COMPREPLY=(bar foo bar baz) ; } $ complete -F _foo foo $ foo TAB bar baz foo So that | sort | uniq might not be necessary after all, and by removing them we could spare two fork()+exec()s. I'm not sure all supported Bash versions behave this way, though. Best, Gábor -- 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
Re: [PATCH 2/2] cherry-pick: add --skip-commits option
Felipe Contreras wrote: Pretty much what it says on the tin. Only that it add --skip-empty and not --skip-commit ?!? Bye, Jojo -- 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
Re: [PATCH] prompt: fix show upstream with svn and zsh
Hi, On Wed, May 22, 2013 at 09:32:44AM +0200, Thomas Gummerer wrote: SZEDER Gábor sze...@ira.uka.de writes: On Tue, May 21, 2013 at 10:54:27PM +0200, Thomas Gummerer wrote: - svn_remote[ $((${#svn_remote[@]} + 1)) ]=$value + svn_remote[$((${#svn_remote[@]} + 1))]=$value I mean, did zsh really complained because of the space after the '[' ?! Yes, removing the spaces after the '[' fixes the problem. I'm not very proficient in shell scripting, so I can't tell if there is another cause. Thanks. I first suspected that this was just an independent style cleanup, that's why I asked for clarification. Gábor -- 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
Re: [PATCH 1/2] sequencer: trivial fix
On Mon, May 27, 2013 at 11:52:18AM -0500, Felipe Contreras wrote: We should free objects before leaving. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sequencer.c b/sequencer.c index ab6f8a7..7eeae2f 100644 --- a/sequencer.c +++ b/sequencer.c @@ -626,12 +626,15 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) rerere(opts-allow_rerere_auto); } else { int allow = allow_empty(opts, commit); - if (allow 0) - return allow; + if (allow 0) { + res = allow; + goto leave; + } if (!opts-no_commit) res = run_git_commit(defmsg, opts, allow); } +leave: free_message(msg); free(defmsg); -- 1.8.3.rc3.312.g47657de Acked-by: Neil Horman nhor...@tuxdriver.com -- 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
Re: [PATCH 2/2] cherry-pick: add --skip-commits option
On Mon, May 27, 2013 at 11:52:19AM -0500, Felipe Contreras wrote: Pretty much what it says on the tin. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-cherry-pick.txt | 3 +++ builtin/revert.c| 2 ++ sequencer.c | 5 - sequencer.h | 1 + t/t3508-cherry-pick-many-commits.sh | 13 + 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index c205d23..fccd936 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -129,6 +129,9 @@ effect to your index in a row. redundant commits are ignored. This option overrides that behavior and creates an empty commit object. Implies `--allow-empty`. +--skip-empty:: + Instead of failing, skip commits that are or become empty. + --strategy=strategy:: Use the given merge strategy. Should only be used once. See the MERGE STRATEGIES section in linkgit:git-merge[1] diff --git a/builtin/revert.c b/builtin/revert.c index 0401fdb..0e5ce71 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -118,6 +118,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), OPT_END(), OPT_END(), + OPT_END(), }; if (opts-action == REPLAY_PICK) { @@ -127,6 +128,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_BOOLEAN(0, allow-empty, opts-allow_empty, N_(preserve initially empty commits)), OPT_BOOLEAN(0, allow-empty-message, opts-allow_empty_message, N_(allow commits with empty messages)), OPT_BOOLEAN(0, keep-redundant-commits, opts-keep_redundant_commits, N_(keep redundant, empty commits)), + OPT_BOOLEAN(0, skip-empty, opts-skip_empty, N_(skip empty commits)), OPT_END(), }; I like the idea, but this option seems a bit awkward to me. At the very least here, don't you now need to check for conflicts if --keep-redundant-commits and skip-empty are both specified (as iirc git doens't see the difference between empty commits and commits made empty by prior commits in the current history). what if we merged the two options to an OPT_STRING, something like --empty-commits=[keep|skip|ask]. The default currently is an impiled, since the sequencer stops on an empty commit. Neil -- 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
Re: git-svn too slow, contacts upstream svn repo
On Tue, 28 May 2013 15:42:57 +0800 (SGT) Quark unixuser2000-f...@yahoo.com wrote: I have been using git-svn in an corporate environment where svn repo has lot of branches, (lot means 100). To avoid cloning all branches my config looks as below [...] is this not right forum? As a matter of fact, this mailing list is the only correct place to ask questions like yours. But this is free software after all -- people who could answer your question may be busy/absent at the moment or even not involved in the project anymore (in the worst case). So be prepared to wait some time. Also be prepared for your particular trouble not being solved. In the meantime, I think Thomas provided you with valuable suggestions in reply to your mirror post on git-users, so you could possibly explore them. -- 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] wildmatch: properly fold case everywhere
Case folding is not done correctly when matching against the [:upper:] character class and uppercased character ranges (e.g. A-Z). Specifically, an uppercase letter fails to match against any of them when case folding is requested because plain characters in the pattern and the whole string and preemptively lowercased to handle the base case fast. That optimization is kept and ISLOWER() is used in the [:upper:] case when case folding is requested, while matching against a character range is retried with toupper() if the character was lowercase. Signed-off-by: Anthony Ramine n.ox...@gmail.com --- t/t3070-wildmatch.sh | 43 +-- wildmatch.c | 7 +++ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh index 4c37057..17315aa 100755 --- a/t/t3070-wildmatch.sh +++ b/t/t3070-wildmatch.sh @@ -6,20 +6,20 @@ test_description='wildmatch tests' match() { if [ $1 = 1 ]; then - test_expect_success wildmatch:match '$3' '$4' + test_expect_success wildmatch: match '$3' '$4' test-wildmatch wildmatch '$3' '$4' else - test_expect_success wildmatch: no match '$3' '$4' + test_expect_success wildmatch: no match '$3' '$4' ! test-wildmatch wildmatch '$3' '$4' fi if [ $2 = 1 ]; then - test_expect_success fnmatch: match '$3' '$4' + test_expect_success fnmatch: match '$3' '$4' test-wildmatch fnmatch '$3' '$4' elif [ $2 = 0 ]; then - test_expect_success fnmatch: no match '$3' '$4' + test_expect_success fnmatch:no match '$3' '$4' ! test-wildmatch fnmatch '$3' '$4' #else @@ -29,13 +29,25 @@ match() { fi } +imatch() { +if [ $1 = 1 ]; then + test_expect_success iwildmatch:match '$2' '$3' + test-wildmatch iwildmatch '$2' '$3' + +else + test_expect_success iwildmatch: no match '$2' '$3' + ! test-wildmatch iwildmatch '$2' '$3' + +fi +} + pathmatch() { if [ $1 = 1 ]; then - test_expect_success pathmatch:match '$2' '$3' + test_expect_success pathmatch: match '$2' '$3' test-wildmatch pathmatch '$2' '$3' else - test_expect_success pathmatch: no match '$2' '$3' + test_expect_success pathmatch: no match '$2' '$3' ! test-wildmatch pathmatch '$2' '$3' fi @@ -235,4 +247,23 @@ pathmatch 1 abcXdefXghi '*X*i' pathmatch 1 ab/cXd/efXg/hi '*/*X*/*/*i' pathmatch 1 ab/cXd/efXg/hi '*Xg*i' +# Case-sensitivy features +match 0 x 'a' '[A-Z]' +match 1 x 'A' '[A-Z]' +match 0 x 'A' '[a-z]' +match 1 x 'a' '[a-z]' +match 0 x 'a' '[[:upper:]]' +match 1 x 'A' '[[:upper:]]' +match 0 x 'A' '[[:lower:]]' +match 1 x 'a' '[[:lower:]]' + +imatch 1 'a' '[A-Z]' +imatch 1 'A' '[A-Z]' +imatch 1 'A' '[a-z]' +imatch 1 'a' '[a-z]' +imatch 1 'a' '[[:upper:]]' +imatch 1 'A' '[[:upper:]]' +imatch 1 'A' '[[:lower:]]' +imatch 1 'a' '[[:lower:]]' + test_done diff --git a/wildmatch.c b/wildmatch.c index 7192bdc..ea318d3 100644 --- a/wildmatch.c +++ b/wildmatch.c @@ -196,6 +196,11 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags) } if (t_ch = p_ch t_ch = prev_ch) matched = 1; + else if ((flags WM_CASEFOLD) ISLOWER(t_ch)) { + t_ch = toupper(t_ch); + if (t_ch = p_ch t_ch = prev_ch) + matched = 1; + } p_ch = 0; /* This makes prev_ch get set to 0. */ } else if (p_ch == '[' p[1] == ':') { const uchar *s; @@ -245,6 +250,8 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags) } else if (CC_EQ(s,i, upper)) { if (ISUPPER(t_ch)) matched = 1; + else if ((flags WM_CASEFOLD) ISLOWER(t_ch)) + matched = 1; } else if (CC_EQ(s,i, xdigit)) { if (ISXDIGIT(t_ch)) matched = 1; -- 1.8.3 -- 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 0/5] Trivial patches
Hi, Here's a bunch of trivial patches. Felipe Contreras (5): remote: trivial style cleanup sequencer: trivial fix test: trivial cleanups test: improve rebase -q test test: rebase: fix --interactive test remote.c | 3 +-- sequencer.c | 7 +-- t/t3400-rebase.sh | 1 + t/t3403-rebase-skip.sh| 7 --- t/t3404-rebase-interactive.sh | 2 +- t/t3505-cherry-pick-empty.sh | 18 +- 6 files changed, 17 insertions(+), 21 deletions(-) -- 1.8.3.rc3.312.g47657de -- 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/5] remote: trivial style cleanup
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- remote.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/remote.c b/remote.c index 68eb99b..e71f66d 100644 --- a/remote.c +++ b/remote.c @@ -1474,8 +1474,7 @@ struct branch *branch_get(const char *name) ret-remote = remote_get(ret-remote_name); if (ret-merge_nr) { int i; - ret-merge = xcalloc(sizeof(*ret-merge), -ret-merge_nr); + ret-merge = xcalloc(ret-merge_nr, sizeof(*ret-merge)); for (i = 0; i ret-merge_nr; i++) { ret-merge[i] = xcalloc(1, sizeof(**ret-merge)); ret-merge[i]-src = xstrdup(ret-merge_name[i]); -- 1.8.3.rc3.312.g47657de -- 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 2/5] sequencer: trivial fix
We should free objects before leaving. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sequencer.c b/sequencer.c index ab6f8a7..7eeae2f 100644 --- a/sequencer.c +++ b/sequencer.c @@ -626,12 +626,15 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) rerere(opts-allow_rerere_auto); } else { int allow = allow_empty(opts, commit); - if (allow 0) - return allow; + if (allow 0) { + res = allow; + goto leave; + } if (!opts-no_commit) res = run_git_commit(defmsg, opts, allow); } +leave: free_message(msg); free(defmsg); -- 1.8.3.rc3.312.g47657de -- 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 3/5] test: trivial cleanups
No functional changes. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- t/t3403-rebase-skip.sh | 7 --- t/t3505-cherry-pick-empty.sh | 18 +- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index 826500b..3968020 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -64,10 +64,11 @@ test_expect_success 'rebase with --merge' ' test_expect_success 'rebase --skip with --merge' ' git rebase --skip - ' +' -test_expect_success 'merge and reference trees equal' \ - 'test -z `git diff-tree skip-merge skip-reference`' +test_expect_success 'merge and reference trees equal' ' + test -z `git diff-tree skip-merge skip-reference` +' test_expect_success 'moved back to branch correctly' ' test refs/heads/skip-merge = $(git symbolic-ref HEAD) diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh index a0c6e30..fbdc47c 100755 --- a/t/t3505-cherry-pick-empty.sh +++ b/t/t3505-cherry-pick-empty.sh @@ -28,29 +28,21 @@ test_expect_success setup ' ' test_expect_success 'cherry-pick an empty commit' ' - git checkout master { - git cherry-pick empty-branch^ - test $? = 1 - } + git checkout master + test_expect_code 1 git cherry-pick empty-branch^ ' test_expect_success 'index lockfile was removed' ' - test ! -f .git/index.lock - ' test_expect_success 'cherry-pick a commit with an empty message' ' - git checkout master { - git cherry-pick empty-branch - test $? = 1 - } + git checkout master + test_expect_code 1 git cherry-pick empty-branch ' test_expect_success 'index lockfile was removed' ' - test ! -f .git/index.lock - ' test_expect_success 'cherry-pick a commit with an empty message with --allow-empty-message' ' @@ -101,7 +93,7 @@ test_expect_success 'cherry-pick a no-op with --keep-redundant' ' git reset --hard git checkout fork^0 git cherry-pick --keep-redundant-commits master - git show -s --format='%s' actual + git show -s --format=%s actual echo add file2 on master expect test_cmp expect actual ' -- 1.8.3.rc3.312.g47657de -- 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 4/5] test: improve rebase -q test
Let's show the output so it's clear why it failed. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- t/t3400-rebase.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index b58fa1a..fb39531 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -185,6 +185,7 @@ test_expect_success 'default to @{upstream} when upstream arg is missing' ' test_expect_success 'rebase -q is quiet' ' git checkout -b quiet topic git rebase -q master output.out 21 + cat output.out test ! -s output.out ' -- 1.8.3.rc3.312.g47657de -- 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 5/5] test: rebase: fix --interactive test
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- t/t3404-rebase-interactive.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index a58406d..79e8d3c 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -692,7 +692,7 @@ test_expect_success 'rebase -i can copy notes' ' test_commit n2 test_commit n3 git notes add -ma note n3 - git rebase --onto n1 n2 + git rebase -i --onto n1 n2 test a note = $(git notes show HEAD) ' -- 1.8.3.rc3.312.g47657de -- 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
Re[4]: [PATCH 4/5] git-svn: fix bottleneck in stash_placeholder_list()
IB * I think git-svn doesn't handle the case, when a tag is deleted. IB I expected it to rename the ref from tags/tagname to IB tags/tagname@rev, but that doesn't happen. IB If a tag is replaced, there's no way to tell what was the previous IB state of that tag: git-svn just rewrites the ref. OK, I figured out that git-svn creates a merge commit having one of its parents the previous state of the tag and another parent the state of the new copy src folder. -- 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 0/3] cherry-pick: improvments
Hi, Here's a bunch of changes to make cherry-pick (and revert) more useful. Felipe Contreras (3): cherry-pick: add support to copy notes revert/cherry-pick: add --quiet option revert/cherry-pick: add --skip option Documentation/git-cherry-pick.txt | 7 +- Documentation/git-revert.txt | 7 +- Documentation/sequencer.txt | 3 + builtin/revert.c | 9 +++ sequencer.c | 162 +- sequencer.h | 6 +- t/t3500-cherry.sh | 32 t/t3510-cherry-pick-sequence.sh | 12 +++ 8 files changed, 232 insertions(+), 6 deletions(-) -- 1.8.3.rc3.312.g47657de -- 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/3] cherry-pick: add support to copy notes
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- builtin/revert.c | 2 + sequencer.c | 136 -- sequencer.h | 2 + t/t3500-cherry.sh | 32 + 4 files changed, 169 insertions(+), 3 deletions(-) diff --git a/builtin/revert.c b/builtin/revert.c index 0e5ce71..b977124 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -119,6 +119,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), OPT_END(), OPT_END(), + OPT_END(), }; if (opts-action == REPLAY_PICK) { @@ -129,6 +130,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_BOOLEAN(0, allow-empty-message, opts-allow_empty_message, N_(allow commits with empty messages)), OPT_BOOLEAN(0, keep-redundant-commits, opts-keep_redundant_commits, N_(keep redundant, empty commits)), OPT_BOOLEAN(0, skip-empty, opts-skip_empty, N_(skip empty commits)), + OPT_BOOLEAN(0, copy-notes, opts-copy_notes, N_(copy notes)), OPT_END(), }; if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra)) diff --git a/sequencer.c b/sequencer.c index edf141d..35a84ad 100644 --- a/sequencer.c +++ b/sequencer.c @@ -20,6 +20,18 @@ const char sign_off_header[] = Signed-off-by: ; static const char cherry_picked_prefix[] = (cherry picked from commit ; +struct rewritten_list_item { + unsigned char from[20]; + unsigned char to[20]; +}; + +struct rewritten_list { + struct rewritten_list_item *items; + unsigned int nr, alloc; +}; + +static struct rewritten_list rewritten; + static int is_rfc2822_line(const char *buf, int len) { int i; @@ -102,6 +114,40 @@ static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob, return 1; } +static void add_rewritten(unsigned char *from, unsigned char *to) +{ + struct rewritten_list_item *item; + if (rewritten.nr + 1 = rewritten.alloc) { + rewritten.alloc += 32; + rewritten.items = xrealloc(rewritten.items, rewritten.alloc * sizeof(*rewritten.items)); + } + item = rewritten.items[rewritten.nr]; + hashcpy(item-from, from); + hashcpy(item-to, to); + rewritten.nr++; +} + +static void copy_notes(void) +{ + unsigned char note_commit[20]; + struct strbuf buf = STRBUF_INIT; + struct notes_tree *t = default_notes_tree; + int i; + + init_notes(t, NULL, NULL, 0); + + for (i = 0; i rewritten.nr; i++) { + struct rewritten_list_item *item = rewritten.items[i]; + copy_note(t, item-from, item-to, 0, NULL); + } + + strbuf_addstr(buf, Notes added by 'git cherry-pick'\n); + create_notes_commit(default_notes_tree, NULL, buf, note_commit); + strbuf_insert(buf, 0, notes: , 7); + update_ref(buf.buf, t-ref, note_commit, NULL, 0, MSG_ON_ERR); + strbuf_release(buf); +} + static void remove_sequencer_state(void) { struct strbuf seq_dir = STRBUF_INIT; @@ -641,6 +687,14 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) res = run_git_commit(defmsg, opts, allow); } + if (!res opts-copy_notes) { + unsigned char to[20]; + + if (read_ref(HEAD, to)) + goto leave; + + add_rewritten(commit-object.sha1, to); + } leave: free_message(msg); free(defmsg); @@ -786,6 +840,40 @@ static void read_populate_todo(struct commit_list **todo_list, die(_(Unusable instruction sheet: %s), todo_file); } +static void read_populate_rewritten(void) +{ + const char *rewritten_file = git_path(SEQ_REWR_FILE); + struct strbuf buf = STRBUF_INIT; + char *p; + int fd; + + fd = open(rewritten_file, O_RDONLY); + if (fd 0) + return; + if (strbuf_read(buf, fd, 0) 0) { + close(fd); + strbuf_release(buf); + return; + } + close(fd); + + for (p = buf.buf; *p;) { + unsigned char from[20]; + unsigned char to[20]; + char *eol = strchrnul(p, '\n'); + if (eol - p != 81) + /* wrong size */ + break; + if (get_sha1_hex(p, from)) + break; + if (get_sha1_hex(p + 41, to)) + break; + add_rewritten(from, to); + p = *eol ? eol + 1 : eol; + } + strbuf_release(buf); +} + static int populate_opts_cb(const char *key, const char *value, void *data) { struct replay_opts *opts = data; @@ -810,7 +898,10 @@
[PATCH 2/3] revert/cherry-pick: add --quiet option
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-cherry-pick.txt | 6 +- Documentation/git-revert.txt | 6 +- builtin/revert.c | 1 + sequencer.c | 2 ++ sequencer.h | 1 + 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index fccd936..da0bd81 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -8,7 +8,7 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... +'git cherry-pick' [-q] [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort @@ -51,6 +51,10 @@ OPTIONS feed all commit... arguments to a single revision walk (see a later example that uses 'maint master..next'). +-q:: +--quiet:: + Quiet, suppress feedback messages. + -e:: --edit:: With this option, 'git cherry-pick' will let you edit the commit diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index f79c9d8..98a8e7a 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] commit... +'git revert' [-q] [--[no-]edit] [-n] [-m parent-number] [-s] commit... 'git revert' --continue 'git revert' --quit 'git revert' --abort @@ -40,6 +40,10 @@ OPTIONS default, see linkgit:git-rev-list[1] and its '--no-walk' option. +-q:: +--quiet:: + Quiet, suppress feedback messages. + -e:: --edit:: With this option, 'git revert' will let you edit the commit diff --git a/builtin/revert.c b/builtin/revert.c index b977124..d63b4a6 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -100,6 +100,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) int contin = 0; int rollback = 0; struct option options[] = { + OPT__QUIET(opts-quiet, N_(suppress progress reporting)), OPT_BOOLEAN(0, quit, remove_state, N_(end revert or cherry-pick sequence)), OPT_BOOLEAN(0, continue, contin, N_(resume revert or cherry-pick sequence)), OPT_BOOLEAN(0, abort, rollback, N_(cancel revert or cherry-pick sequence)), diff --git a/sequencer.c b/sequencer.c index 35a84ad..b4e395a 100644 --- a/sequencer.c +++ b/sequencer.c @@ -435,6 +435,8 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, argv_array_init(array); argv_array_push(array, commit); argv_array_push(array, -n); + if (opts-quiet) + argv_array_push(array, -q); if (opts-signoff) argv_array_push(array, -s); diff --git a/sequencer.h b/sequencer.h index 6cc072c..41e19d0 100644 --- a/sequencer.h +++ b/sequencer.h @@ -37,6 +37,7 @@ struct replay_opts { int keep_redundant_commits; int skip_empty; int copy_notes; + int quiet; int mainline; -- 1.8.3.rc3.312.g47657de -- 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 3/3] revert/cherry-pick: add --skip option
Akin to 'am --skip' and 'rebase --skip'. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-cherry-pick.txt | 1 + Documentation/git-revert.txt | 1 + Documentation/sequencer.txt | 3 +++ builtin/revert.c | 6 ++ sequencer.c | 24 sequencer.h | 3 ++- t/t3510-cherry-pick-sequence.sh | 12 7 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index da0bd81..d95c63c 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -10,6 +10,7 @@ SYNOPSIS [verse] 'git cherry-pick' [-q] [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... 'git cherry-pick' --continue +'git cherry-pick' --skip 'git cherry-pick' --quit 'git cherry-pick' --abort diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index 98a8e7a..52e146e 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -10,6 +10,7 @@ SYNOPSIS [verse] 'git revert' [-q] [--[no-]edit] [-n] [-m parent-number] [-s] commit... 'git revert' --continue +'git revert' --skip 'git revert' --quit 'git revert' --abort diff --git a/Documentation/sequencer.txt b/Documentation/sequencer.txt index 5747f44..df2d355 100644 --- a/Documentation/sequencer.txt +++ b/Documentation/sequencer.txt @@ -3,6 +3,9 @@ '.git/sequencer'. Can be used to continue after resolving conflicts in a failed cherry-pick or revert. +--skip:: + Skip the current commit, and then continue. + --quit:: Forget about the current operation in progress. Can be used to clear the sequencer state after a failed cherry-pick or diff --git a/builtin/revert.c b/builtin/revert.c index d63b4a6..6afd990 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -99,11 +99,13 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) int remove_state = 0; int contin = 0; int rollback = 0; + int skip = 0; struct option options[] = { OPT__QUIET(opts-quiet, N_(suppress progress reporting)), OPT_BOOLEAN(0, quit, remove_state, N_(end revert or cherry-pick sequence)), OPT_BOOLEAN(0, continue, contin, N_(resume revert or cherry-pick sequence)), OPT_BOOLEAN(0, abort, rollback, N_(cancel revert or cherry-pick sequence)), + OPT_BOOLEAN(0, skip, skip, N_(skip current commit in the sequence)), OPT_BOOLEAN('n', no-commit, opts-no_commit, N_(don't automatically commit)), OPT_BOOLEAN('e', edit, opts-edit, N_(edit the commit message)), OPT_NOOP_NOARG('r', NULL), @@ -160,6 +162,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) opts-subcommand = REPLAY_CONTINUE; else if (rollback) opts-subcommand = REPLAY_ROLLBACK; + else if (skip) + opts-subcommand = REPLAY_SKIP; else opts-subcommand = REPLAY_NONE; @@ -170,6 +174,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) this_operation = --quit; else if (opts-subcommand == REPLAY_CONTINUE) this_operation = --continue; + else if (opts-subcommand == REPLAY_SKIP) + this_operation = --skip; else { assert(opts-subcommand == REPLAY_ROLLBACK); this_operation = --abort; diff --git a/sequencer.c b/sequencer.c index b4e395a..971cab2 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1173,6 +1173,28 @@ static int sequencer_continue(struct replay_opts *opts) return pick_commits(todo_list, opts); } +static int sequencer_skip(struct replay_opts *opts) +{ + const char *argv[4]; /* reset --hard HEAD + NULL */ + struct string_list merge_rr = STRING_LIST_INIT_DUP; + int ret; + + if (setup_rerere(merge_rr, 0) = 0) { + rerere_clear(merge_rr); + string_list_clear(merge_rr, 1); + } + + argv[0] = reset; + argv[1] = --hard; + argv[2] = HEAD; + argv[3] = NULL; + ret = run_command_v_opt(argv, RUN_GIT_CMD); + if (ret) + return ret; + + return sequencer_continue(opts); +} + static int single_pick(struct commit *cmit, struct replay_opts *opts) { int ret; @@ -1209,6 +1231,8 @@ int sequencer_pick_revisions(struct replay_opts *opts) return sequencer_rollback(opts); if (opts-subcommand == REPLAY_CONTINUE) return sequencer_continue(opts); + if (opts-subcommand == REPLAY_SKIP) + return sequencer_skip(opts); for (i = 0; i opts-revs-pending.nr; i++) { unsigned
Re: [PATCH] wildmatch: properly fold case everywhere
You're right, I will amend my patch. How do I make git-send-email reply to that thread? -- Anthony Ramine Le 28 mai 2013 à 14:53, Duy Nguyen a écrit : On Tue, May 28, 2013 at 7:32 PM, Anthony Ramine n.ox...@gmail.com wrote: @@ -196,6 +196,11 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags) } if (t_ch = p_ch t_ch = prev_ch) matched = 1; + else if ((flags WM_CASEFOLD) ISLOWER(t_ch)) { + t_ch = toupper(t_ch); This happens in a while loop where t_ch may be used again. Should we make a local copy of toupper(t_ch) and leave t_ch untouched? + if (t_ch = p_ch t_ch = prev_ch) + matched = 1; + } p_ch = 0; /* This makes prev_ch get set to 0. */ } else if (p_ch == '[' p[1] == ':') { const uchar *s; -- Duy -- 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 v2] wildmatch: properly fold case everywhere
Case folding is not done correctly when matching against the [:upper:] character class and uppercased character ranges (e.g. A-Z). Specifically, an uppercase letter fails to match against any of them when case folding is requested because plain characters in the pattern and the whole string and preemptively lowercased to handle the base case fast. That optimization is kept and ISLOWER() is used in the [:upper:] case when case folding is requested, while matching against a character range is retried with toupper() if the character was lowercase. Signed-off-by: Anthony Ramine n.ox...@gmail.com --- t/t3070-wildmatch.sh | 47 +-- wildmatch.c | 7 +++ 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh index 4c37057..e1b45e6 100755 --- a/t/t3070-wildmatch.sh +++ b/t/t3070-wildmatch.sh @@ -6,20 +6,20 @@ test_description='wildmatch tests' match() { if [ $1 = 1 ]; then - test_expect_success wildmatch:match '$3' '$4' + test_expect_success wildmatch: match '$3' '$4' test-wildmatch wildmatch '$3' '$4' else - test_expect_success wildmatch: no match '$3' '$4' + test_expect_success wildmatch: no match '$3' '$4' ! test-wildmatch wildmatch '$3' '$4' fi if [ $2 = 1 ]; then - test_expect_success fnmatch: match '$3' '$4' + test_expect_success fnmatch: match '$3' '$4' test-wildmatch fnmatch '$3' '$4' elif [ $2 = 0 ]; then - test_expect_success fnmatch: no match '$3' '$4' + test_expect_success fnmatch:no match '$3' '$4' ! test-wildmatch fnmatch '$3' '$4' #else @@ -29,13 +29,25 @@ match() { fi } +imatch() { +if [ $1 = 1 ]; then + test_expect_success iwildmatch:match '$2' '$3' + test-wildmatch iwildmatch '$2' '$3' + +else + test_expect_success iwildmatch: no match '$2' '$3' + ! test-wildmatch iwildmatch '$2' '$3' + +fi +} + pathmatch() { if [ $1 = 1 ]; then - test_expect_success pathmatch:match '$2' '$3' + test_expect_success pathmatch: match '$2' '$3' test-wildmatch pathmatch '$2' '$3' else - test_expect_success pathmatch: no match '$2' '$3' + test_expect_success pathmatch: no match '$2' '$3' ! test-wildmatch pathmatch '$2' '$3' fi @@ -235,4 +247,27 @@ pathmatch 1 abcXdefXghi '*X*i' pathmatch 1 ab/cXd/efXg/hi '*/*X*/*/*i' pathmatch 1 ab/cXd/efXg/hi '*Xg*i' +# Case-sensitivy features +match 0 x 'a' '[A-Z]' +match 1 x 'A' '[A-Z]' +match 0 x 'A' '[a-z]' +match 1 x 'a' '[a-z]' +match 0 x 'a' '[[:upper:]]' +match 1 x 'A' '[[:upper:]]' +match 0 x 'A' '[[:lower:]]' +match 1 x 'a' '[[:lower:]]' +match 0 x 'A' '[B-Za]' +match 1 x 'a' '[B-Za]' + +imatch 1 'a' '[A-Z]' +imatch 1 'A' '[A-Z]' +imatch 1 'A' '[a-z]' +imatch 1 'a' '[a-z]' +imatch 1 'a' '[[:upper:]]' +imatch 1 'A' '[[:upper:]]' +imatch 1 'A' '[[:lower:]]' +imatch 1 'a' '[[:lower:]]' +imatch 1 'A' '[B-Za]' +imatch 1 'a' '[B-Za]' + test_done diff --git a/wildmatch.c b/wildmatch.c index 7192bdc..ea318d3 100644 --- a/wildmatch.c +++ b/wildmatch.c @@ -196,6 +196,11 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags) } if (t_ch = p_ch t_ch = prev_ch) matched = 1; + else if ((flags WM_CASEFOLD) ISLOWER(t_ch)) { + t_ch = toupper(t_ch); + if (t_ch = p_ch t_ch = prev_ch) + matched = 1; + } p_ch = 0; /* This makes prev_ch get set to 0. */ } else if (p_ch == '[' p[1] == ':') { const uchar *s; @@ -245,6 +250,8 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags) } else if (CC_EQ(s,i, upper)) { if (ISUPPER(t_ch)) matched = 1; + else if ((flags WM_CASEFOLD) ISLOWER(t_ch)) + matched = 1; } else if (CC_EQ(s,i, xdigit)) { if (ISXDIGIT(t_ch)) matched = 1; -- 1.8.3 -- 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
[PATCH 0/5] rebase: improve the keep-empty
Hi, I've been analyzing 'git rebase' and found that the --keep-empty option triggers a very very different behavior. Here's a bunch of patches that make it behave like the 'am' does does for the most part. There's only a few minor changes, after which it might be possible to replace the whole 'am' mode to use cherr-pick instead. Felipe Contreras (5): rebase: split the cherry-pick stuff rebase: fix 'cherry' mode storage rebase: fix sequence continuation rebase: fix abort of cherry mode rebase: fix cherry-pick invocations .gitignore| 1 + Makefile | 1 + git-rebase--am.sh | 65 ++- git-rebase--cherry.sh | 55 +++ git-rebase.sh | 8 +++ 5 files changed, 93 insertions(+), 37 deletions(-) create mode 100644 git-rebase--cherry.sh -- 1.8.3.rc3.312.g47657de -- 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/5] rebase: split the cherry-pick stuff
They do something completely different from 'git am', it belongs in a different file. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- .gitignore| 1 + Makefile | 1 + git-rebase--am.sh | 65 ++- git-rebase--cherry.sh | 34 +++ git-rebase.sh | 4 5 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 git-rebase--cherry.sh diff --git a/.gitignore b/.gitignore index 6669bf0..284fc8f 100644 --- a/.gitignore +++ b/.gitignore @@ -113,6 +113,7 @@ /git-read-tree /git-rebase /git-rebase--am +/git-rebase--cherry /git-rebase--interactive /git-rebase--merge /git-receive-pack diff --git a/Makefile b/Makefile index 0f931a2..a3cd4bc 100644 --- a/Makefile +++ b/Makefile @@ -469,6 +469,7 @@ SCRIPT_SH += git-web--browse.sh SCRIPT_LIB += git-mergetool--lib SCRIPT_LIB += git-parse-remote SCRIPT_LIB += git-rebase--am +SCRIPT_LIB += git-rebase--cherry SCRIPT_LIB += git-rebase--interactive SCRIPT_LIB += git-rebase--merge SCRIPT_LIB += git-sh-setup diff --git a/git-rebase--am.sh b/git-rebase--am.sh index f84854f..ee1b1b9 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -19,52 +19,43 @@ esac test -n $rebase_root root_flag=--root ret=0 -if test -n $keep_empty -then - # we have to do this the hard way. git format-patch completely squashes - # empty commits and even if it didn't the format doesn't really lend - # itself well to recording empty patches. fortunately, cherry-pick - # makes this easy - git cherry-pick --allow-empty $revisions - ret=$? -else - rm -f $GIT_DIR/rebased-patches - - git format-patch -k --stdout --full-index --ignore-if-in-upstream \ - --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \ - $root_flag $revisions $GIT_DIR/rebased-patches - ret=$? - if test 0 != $ret - then - rm -f $GIT_DIR/rebased-patches - case $head_name in - refs/heads/*) - git checkout -q $head_name - ;; - *) - git checkout -q $orig_head - ;; - esac +rm -f $GIT_DIR/rebased-patches - cat 2 -EOF +git format-patch -k --stdout --full-index --ignore-if-in-upstream \ + --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \ + $root_flag $revisions $GIT_DIR/rebased-patches +ret=$? - git encountered an error while preparing the patches to replay - these revisions: +if test 0 != $ret +then + rm -f $GIT_DIR/rebased-patches + case $head_name in + refs/heads/*) + git checkout -q $head_name + ;; + *) + git checkout -q $orig_head + ;; + esac - $revisions + cat 2 -EOF - As a result, git cannot rebase them. - EOF - exit $? - fi + git encountered an error while preparing the patches to replay + these revisions: - git am $git_am_opt --rebasing --resolvemsg=$resolvemsg $GIT_DIR/rebased-patches - ret=$? + $revisions - rm -f $GIT_DIR/rebased-patches + As a result, git cannot rebase them. + EOF + exit $? fi +git am $git_am_opt --rebasing --resolvemsg=$resolvemsg $GIT_DIR/rebased-patches +ret=$? + +rm -f $GIT_DIR/rebased-patches + if test 0 != $ret then test -d $state_dir write_basic_state diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh new file mode 100644 index 000..cbf80f9 --- /dev/null +++ b/git-rebase--cherry.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Copyright (c) 2010 Junio C Hamano. +# + +case $action in +continue) + git am --resolved --resolvemsg=$resolvemsg + move_to_original_branch + exit + ;; +skip) + git am --skip --resolvemsg=$resolvemsg + move_to_original_branch + exit + ;; +esac + +test -n $rebase_root root_flag=--root + +# we have to do this the hard way. git format-patch completely squashes +# empty commits and even if it didn't the format doesn't really lend +# itself well to recording empty patches. fortunately, cherry-pick +# makes this easy +git cherry-pick --allow-empty $revisions +ret=$? + +if test 0 != $ret +then + test -d $state_dir write_basic_state + exit $ret +fi + +move_to_original_branch diff --git a/git-rebase.sh b/git-rebase.sh index 2c692c3..2754985 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -379,6 +379,10 @@ elif test -n $do_merge then type=merge state_dir=$merge_dir +elif test -n $keep_empty +then + type=cherry + state_dir=$apply_dir else type=am state_dir=$apply_dir -- 1.8.3.rc3.312.g47657de -- To unsubscribe from this list: send the line unsubscribe git in the
[PATCH 2/5] rebase: fix 'cherry' mode storage
We don't use the 'rebase-apply'. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 4 git-rebase.sh | 5 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index cbf80f9..ab1f8b7 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -18,6 +18,9 @@ esac test -n $rebase_root root_flag=--root +mkdir $state_dir || die Could not create temporary $state_dir +: $state_dir/cherry || die Could not mark as cherry + # we have to do this the hard way. git format-patch completely squashes # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick @@ -32,3 +35,4 @@ then fi move_to_original_branch +rm -rf $state_dir diff --git a/git-rebase.sh b/git-rebase.sh index 2754985..b7759d5 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -174,6 +174,9 @@ then then type=interactive interactive_rebase=explicit + elif test -f $merge_dir/cherry + then + type=cherry else type=merge fi @@ -382,7 +385,7 @@ then elif test -n $keep_empty then type=cherry - state_dir=$apply_dir + state_dir=$merge_dir else type=am state_dir=$apply_dir -- 1.8.3.rc3.312.g47657de -- 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 4/5] rebase: fix abort of cherry mode
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git-rebase.sh b/git-rebase.sh index b7759d5..48bd1b8 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -335,6 +335,7 @@ skip) run_specific_rebase ;; abort) + test $type == cherry git cherry-pick --abort git rerere clear read_basic_state case $head_name in -- 1.8.3.rc3.312.g47657de -- 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 5/5] rebase: fix cherry-pick invocations
So that all the tests pass. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index ca78b1b..c3a2ac9 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -23,11 +23,26 @@ test -n $rebase_root root_flag=--root mkdir $state_dir || die Could not create temporary $state_dir : $state_dir/cherry || die Could not mark as cherry +if test -n $rebase_root +then + revisions=$onto...$orig_head +else + revisions=$upstream...$orig_head +fi + # we have to do this the hard way. git format-patch completely squashes # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy -git cherry-pick --allow-empty $revisions +if test -n $keep_empty +then + extra=--allow-empty +else + extra=--skip-empty --cherry-pick +fi +test -n $GIT_QUIET extra=$extra -q +test -z $force_rebase extra=$extra --ff +git cherry-pick --no-merges --right-only --topo-order --do-walk --copy-notes $extra $revisions ret=$? if test 0 != $ret -- 1.8.3.rc3.312.g47657de -- 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 3/5] rebase: fix sequence continuation
We are not in am mode. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index ab1f8b7..ca78b1b 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -5,13 +5,15 @@ case $action in continue) - git am --resolved --resolvemsg=$resolvemsg - move_to_original_branch + git cherry-pick --continue + move_to_original_branch + rm -rf $state_dir exit ;; skip) - git am --skip --resolvemsg=$resolvemsg - move_to_original_branch + git cherry-pick --skip + move_to_original_branch + rm -rf $state_dir exit ;; esac -- 1.8.3.rc3.312.g47657de -- 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
Re: [PATCH 0/5] rebase: improve the keep-empty
On Tue, May 28, 2013 at 8:29 AM, Felipe Contreras felipe.contre...@gmail.com wrote: Hi, I've been analyzing 'git rebase' and found that the --keep-empty option triggers a very very different behavior. Here's a bunch of patches that make it behave like the 'am' does does for the most part. There's only a few minor changes, after which it might be possible to replace the whole 'am' mode to use cherr-pick instead. Felipe Contreras (5): rebase: split the cherry-pick stuff rebase: fix 'cherry' mode storage rebase: fix sequence continuation rebase: fix abort of cherry mode rebase: fix cherry-pick invocations To see the issue, simply enable keep_mode by default, and run the tests: Test Summary Report --- ./t3401-rebase-partial.sh (Wstat: 256 Tests: 7 Failed: 4) Failed tests: 3, 5-7 Non-zero exit status: 1 ./t3403-rebase-skip.sh (Wstat: 256 Tests: 10 Failed: 3) Failed tests: 4-5, 9 Non-zero exit status: 1 ./t3406-rebase-message.sh (Wstat: 256 Tests: 6 Failed: 3) Failed tests: 3-5 Non-zero exit status: 1 ./t3400-rebase.sh (Wstat: 256 Tests: 27 Failed: 10) Failed tests: 13-17, 22-25, 27 Non-zero exit status: 1 ./t3407-rebase-abort.sh(Wstat: 256 Tests: 11 Failed: 5) Failed tests: 2-6 Non-zero exit status: 1 ./t3412-rebase-root.sh (Wstat: 256 Tests: 31 Failed: 17) Failed tests: 4, 6-8, 10-12, 14-17, 23, 25-26, 28-29 31 Non-zero exit status: 1 ./t3417-rebase-whitespace-fix.sh (Wstat: 256 Tests: 4 Failed: 4) Failed tests: 1-4 Non-zero exit status: 1 ./t3419-rebase-patch-id.sh (Wstat: 256 Tests: 9 Failed: 1) Failed test: 4 Non-zero exit status: 1 ./t3418-rebase-continue.sh (Wstat: 256 Tests: 6 Failed: 2) Failed tests: 3, 5 Non-zero exit status: 1 ./t5407-post-rewrite-hook.sh (Wstat: 256 Tests: 13 Failed: 4) Failed tests: 4-6, 8 Non-zero exit status: 1 ./t5520-pull.sh(Wstat: 256 Tests: 21 Failed: 8) Failed tests: 12-15, 18-21 Non-zero exit status: 1 ./t7512-status-help.sh (Wstat: 256 Tests: 35 Failed: 3) Failed tests: 5-6, 28 Non-zero exit status: 1 ./t9106-git-svn-commit-diff-clobber.sh (Wstat: 256 Tests: 10 Failed: 3) Failed tests: 6, 9-10 Non-zero exit status: 1 ./t3404-rebase-interactive.sh (Wstat: 256 Tests: 71 Failed: 2) Failed tests: 50, 69 Non-zero exit status: 1 ./t9137-git-svn-dcommit-clobber-series.sh (Wstat: 256 Tests: 5 Failed: 1) Failed test: 4 Non-zero exit status: 1 ./t9140-git-svn-reset.sh (Wstat: 256 Tests: 6 Failed: 1) Failed test: 6 Non-zero exit status: 1 ./t9903-bash-prompt.sh (Wstat: 256 Tests: 51 Failed: 20) Failed tests: 27-34, 36-39, 41-42, 45-49, 51 Non-zero exit status: 1 ./t9164-git-svn-dcommit-concurrent.sh (Wstat: 256 Tests: 8 Failed: 4) Failed tests: 4-6, 8 Non-zero exit status: 1 Files=629, Tests=10036, 308 wallclock secs ( 7.60 usr 1.39 sys + 556.35 cusr 382.46 csys = 947.80 CPU) Result: FAIL -- Felipe Contreras -- 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 v3] wildmatch: properly fold case everywhere
Case folding is not done correctly when matching against the [:upper:] character class and uppercased character ranges (e.g. A-Z). Specifically, an uppercase letter fails to match against any of them when case folding is requested because plain characters in the pattern and the whole string and preemptively lowercased to handle the base case fast. That optimization is kept and ISLOWER() is used in the [:upper:] case when case folding is requested, while matching against a character range is retried with toupper() if the character was lowercase. Signed-off-by: Anthony Ramine n.ox...@gmail.com --- t/t3070-wildmatch.sh | 47 +-- wildmatch.c | 7 +++ 2 files changed, 48 insertions(+), 6 deletions(-) Please disregard PATCH v2, it is identical to the first one. diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh index 4c37057..e1b45e6 100755 --- a/t/t3070-wildmatch.sh +++ b/t/t3070-wildmatch.sh @@ -6,20 +6,20 @@ test_description='wildmatch tests' match() { if [ $1 = 1 ]; then - test_expect_success wildmatch:match '$3' '$4' + test_expect_success wildmatch: match '$3' '$4' test-wildmatch wildmatch '$3' '$4' else - test_expect_success wildmatch: no match '$3' '$4' + test_expect_success wildmatch: no match '$3' '$4' ! test-wildmatch wildmatch '$3' '$4' fi if [ $2 = 1 ]; then - test_expect_success fnmatch: match '$3' '$4' + test_expect_success fnmatch: match '$3' '$4' test-wildmatch fnmatch '$3' '$4' elif [ $2 = 0 ]; then - test_expect_success fnmatch: no match '$3' '$4' + test_expect_success fnmatch:no match '$3' '$4' ! test-wildmatch fnmatch '$3' '$4' #else @@ -29,13 +29,25 @@ match() { fi } +imatch() { +if [ $1 = 1 ]; then + test_expect_success iwildmatch:match '$2' '$3' + test-wildmatch iwildmatch '$2' '$3' + +else + test_expect_success iwildmatch: no match '$2' '$3' + ! test-wildmatch iwildmatch '$2' '$3' + +fi +} + pathmatch() { if [ $1 = 1 ]; then - test_expect_success pathmatch:match '$2' '$3' + test_expect_success pathmatch: match '$2' '$3' test-wildmatch pathmatch '$2' '$3' else - test_expect_success pathmatch: no match '$2' '$3' + test_expect_success pathmatch: no match '$2' '$3' ! test-wildmatch pathmatch '$2' '$3' fi @@ -235,4 +247,27 @@ pathmatch 1 abcXdefXghi '*X*i' pathmatch 1 ab/cXd/efXg/hi '*/*X*/*/*i' pathmatch 1 ab/cXd/efXg/hi '*Xg*i' +# Case-sensitivy features +match 0 x 'a' '[A-Z]' +match 1 x 'A' '[A-Z]' +match 0 x 'A' '[a-z]' +match 1 x 'a' '[a-z]' +match 0 x 'a' '[[:upper:]]' +match 1 x 'A' '[[:upper:]]' +match 0 x 'A' '[[:lower:]]' +match 1 x 'a' '[[:lower:]]' +match 0 x 'A' '[B-Za]' +match 1 x 'a' '[B-Za]' + +imatch 1 'a' '[A-Z]' +imatch 1 'A' '[A-Z]' +imatch 1 'A' '[a-z]' +imatch 1 'a' '[a-z]' +imatch 1 'a' '[[:upper:]]' +imatch 1 'A' '[[:upper:]]' +imatch 1 'A' '[[:lower:]]' +imatch 1 'a' '[[:lower:]]' +imatch 1 'A' '[B-Za]' +imatch 1 'a' '[B-Za]' + test_done diff --git a/wildmatch.c b/wildmatch.c index 7192bdc..f91ba99 100644 --- a/wildmatch.c +++ b/wildmatch.c @@ -196,6 +196,11 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags) } if (t_ch = p_ch t_ch = prev_ch) matched = 1; + else if ((flags WM_CASEFOLD) ISLOWER(t_ch)) { + uchar t_ch_upper = toupper(t_ch); + if (t_ch_upper = p_ch t_ch_upper = prev_ch) + matched = 1; + } p_ch = 0; /* This makes prev_ch get set to 0. */ } else if (p_ch == '[' p[1] == ':') { const uchar *s; @@ -245,6 +250,8 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags) } else if (CC_EQ(s,i, upper)) { if (ISUPPER(t_ch)) matched = 1; + else if ((flags WM_CASEFOLD) ISLOWER(t_ch)) + matched = 1; } else if (CC_EQ(s,i, xdigit)) { if (ISXDIGIT(t_ch)) matched = 1; -- 1.8.3 -- To unsubscribe from this list: send the line unsubscribe git in the body
Re: [PATCH v2 0/3] Towards a useable git-branch
Hi Duy, I just woke up and started looking at the series: it's rather well done, and I'm confident that this is the way forward. To reciprocate, I've done some work at gh:artagnon/git for-each-ref-pretty. See: https://github.com/artagnon/git/commits/for-each-ref-pretty There is one major problem though: %(N) doesn't work properly with f-e-r, and I'm not sure why. I'm not talking about your last patch where you compute * -- that works fine; it's just that %(N) doesn't when N is a concrete number. Also, a couple of minor annoyances: 1. When f-e-r is invoked with refs/tags, we get stray output. Atleast it doesn't segfault, thanks to your ignore-commit patch. Maybe printing stray output is the right thing to do, as opposed to erroring out. 2. %(*) only works with f-e-r atoms, not with pretty-format atoms. This is ofcourse obvious from the implementation, but isn't it a little consistent? Should we start off a new pretty-ref-formats document, where we explicitly exclude things like %ae (because of the hex overriding thing)? I don't think it's a problem if documented properly. -- 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
Re: [PATCH v2 0/3] Towards a useable git-branch
Oh, and by the way: We're pretty close we are to replacing branch -v and branch -vv. brv = for-each-ref --format='%(HEAD) %C(green)%(*)%(refname:short)%C(reset) %(*)%(objectname:short) %(subject)' refs/heads brvv = for-each-ref --format='%(HEAD) %C(green)%(*)%(refname:short)%C(reset) %(*)%(objectname:short) %C(blue)%(upstream:short)%C(reset) %(subject)' refs/heads There are small differences: 1. In branch -v, the green-color of the branch name is dependent on %(HEAD). Not worth ironing out, in my opinion. 2. In branch -vv, there are dependent square braces that come on when %(refname:short) is set. We might want to introduce an undocumented %(refname:branchvv) for internal use by branch -vv, for backward compatibility. What do you think? -- 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
Re: [PATCH v2 0/3] Towards a useable git-branch
Ramkumar Ramachandra wrote: %(N) doesn't work properly with f-e-r, and I'm not sure why. I'm not talking about your last patch where you compute * -- that works fine; it's just that %(N) doesn't when N is a concrete number. Try this: %(refname:short)%(30)%(upstream:short) (assuming that you have lots of branches). I'm noticing random alignment problems. However, %(N) doesn't seem to have this problem: %(30)%(refname:short)%(upstream:short) I'm not able to figure this out. -- 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
Re: git-svn too slow, contacts upstream svn repo
- Original Message - From: Konstantin Khomoutov kostix+...@007spb.ru To: Quark unixuser2000-f...@yahoo.com Cc: Git List git@vger.kernel.org Sent: Tuesday, 28 May 2013 5:24 PM Subject: Re: git-svn too slow, contacts upstream svn repo On Tue, 28 May 2013 15:42:57 +0800 (SGT) Quark unixuser2000-f...@yahoo.com wrote: I have been using git-svn in an corporate environment where svn repo has lot of branches, (lot means 100). To avoid cloning all branches my config looks as below [...] is this not right forum? As a matter of fact, this mailing list is the only correct place to ask questions like yours. But this is free software after all -- people who could answer your question may be busy/absent at the moment or even not involved in the project anymore (in the worst case). So be prepared to wait some time. Also be prepared for your particular trouble not being solved. In the meantime, I think Thomas provided you with valuable suggestions in reply to your mirror post on git-users, so you could possibly explore them. I was impatient not because feeling-of-entitlement, but I thought it might get lost in pile of e-mails Secondly was not sure if this is right forum, I might be making noise after all, thanks for your clarification. Now will you please excuse, I have to check Thomas's suggestions? :) -- 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
Re: [PATCH] git clone depth of 0 not possible.
Hi Jonathan, Did you consider how to implement this? Looking at the code, it seems the deepen parameter in the wire protocol now means: - 0: Do not change anything about the shallowness (i.e., fetch everything from the shallow root to the tip). - 0: Create new shallow commits at depth commits below the tip (so depth == 1 means tip and one below). - INFINITE_DEPTH (0x7fff): Remove all shallowness and fetch complete history. Given this, I'm not sure how one can express fetch the tip and nothing below that, since depth == 0 already has a different meaning. If I remember correctly, what we discussed is just changing the protocol to 5 means a depth of 5. The mail from Junio I replied to said: As long as we do not change the meaning of the shallow count going over the wire Which seems to conflict with your suggestion. Or are the shallow count and the depth different things? The client already trusts what the server provides. In other words: we won't break existing clients if we suddenly send back one less commit than before, since the client just sends over what it wants and then assumes that whatever it gets back is really what it wanted? Gr. Matthijs -- 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
Re: [PATCH] git clone depth of 0 not possible.
Matthijs Kooijman wrote: In other words: we won't break existing clients if we suddenly send back one less commit than before, since the client just sends over what it wants and then assumes that whatever it gets back is really what it wanted? Yes, depending on your definition of break. An advantage of that approach is that old clients would get the new, intuitive behavior without upgrading. A disadvantage is that it is a confusing world where the same command produces different effects when contacting different servers. -- 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
Re: [PATCH v2 7/8] remote-bzr: reorganize the way 'wanted' works
Felipe Contreras felipe.contre...@gmail.com writes: +wanted = get_config('remote-bzr.branches').rstrip().split(', ') Two minor nits and one design suggestion: - Why rstrip() not strip()? It appears that this only is helping an end-user mistake like this: git config remote-bzr.branches 'trunk, devel, test ' without helping people who have done this: git config remote-bzr.branches 'trunk, devel, test' - Is git config remote-bzr.branches trunk,devel,test a grave sin? In other words, wouldn't we want something like this instead? map(lambda s: s.strip(), get_config('...').split(',')) - Doesn't allowing multi-valued variable, e.g. [remote-bzr] branches = trunk branches = devel branches = test make it easier for the user to manage this configuration by e.g. selectively removing or adding tracked branches? -- 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
Re: [PATCH 1/2] sequencer: trivial fix
Neil Horman nhor...@tuxdriver.com writes: On Mon, May 27, 2013 at 11:52:18AM -0500, Felipe Contreras wrote: We should free objects before leaving. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sequencer.c b/sequencer.c index ab6f8a7..7eeae2f 100644 --- a/sequencer.c +++ b/sequencer.c @@ -626,12 +626,15 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) rerere(opts-allow_rerere_auto); } else { int allow = allow_empty(opts, commit); -if (allow 0) -return allow; +if (allow 0) { +res = allow; +goto leave; +} if (!opts-no_commit) res = run_git_commit(defmsg, opts, allow); } +leave: free_message(msg); free(defmsg); -- 1.8.3.rc3.312.g47657de Acked-by: Neil Horman nhor...@tuxdriver.com This is better done without goto in general. The other patch 2/2/ adds one more we need to exit from the middle of the flow and makes it look handier to add an exit label here, but it would be even better to express the logic of that patch as a normal cascade of if/else if/..., which is small enough and we do not need the leave: label. It probably is better to fold this patch into the other one when it is rerolled to correct the option name gotcha on the tin. Thanks. -- 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
Re: [PATCH RESEND v2] path: Fix a sparse warning
Ramsay Jones ram...@ramsay1.demon.co.uk writes: On MinGW, sparse issues an 'get_st_mode_bits' not declared. Should it be static? warning. The MinGW and MSVC builds do not see the declaration of this function, within git-compat-util.h, due to its placement within an preprocessor conditional. In order to suppress the warning, we simply move the declaration to the top level of the header. Signed-off-by: Ramsay Jones ram...@ramsay1.demon.co.uk --- Hi Junio, Now that v1.8.3 is out, I note that this patch seems to have been dropped (or did I miss something?). This used to be [PATCH 2/6] path: Make the 'get_st_mode_bits' symbol a file static but the change in implementation required a change in title. This version simply moves the declaration so that the MinGW and MSVC builds can see it. Will queue. Can you tell me what the conclusion on the discussion on your two other patches on 'pu'? * rj/mingw-cygwin (2013-05-08) 2 commits - cygwin: Remove the CYGWIN_V15_WIN32API build variable - mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE I stopped keeping track of the discussion and my vague recollection was that it is OK for 1.5 but not verified on 1.7 or something? ATB, Ramsay Jones git-compat-util.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-compat-util.h b/git-compat-util.h index e955bb5..0e5e4f8 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -163,7 +163,6 @@ typedef long intptr_t; typedef unsigned long uintptr_t; #endif -int get_st_mode_bits(const char *path, int *mode); #if defined(__CYGWIN__) #undef _XOPEN_SOURCE #include grp.h @@ -176,6 +175,8 @@ int get_st_mode_bits(const char *path, int *mode); #endif #endif +extern int get_st_mode_bits(const char *path, int *mode); + /* used on Mac OS X */ #ifdef PRECOMPOSE_UNICODE #include compat/precompose_utf8.h -- 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
Re: [PATCH] git clone depth of 0 not possible.
Matthijs Kooijman matth...@stdin.nl writes: Did you consider how to implement this? Looking at the code, it seems the deepen parameter in the wire protocol now means: - 0: Do not change anything about the shallowness (i.e., fetch everything from the shallow root to the tip). - 0: Create new shallow commits at depth commits below the tip (so depth == 1 means tip and one below). - INFINITE_DEPTH (0x7fff): Remove all shallowness and fetch complete history. Given this, I'm not sure how one can express fetch the tip and nothing below that, since depth == 0 already has a different meaning. Doing it correctly (in the shorter term) would involve: - adding a capability on the sending side fixed-off-by-one-depth to the protocol, and teaching the sending side to advertise the capability; - teaching the requestor that got --depth=N from the end user to pay attention to the new capability in such a way that: - when talking to an old sender (i.e. without the off-by-one fix), send N-1 for N greater than 1. Punt on N==1; - when talking to a fixed sender, ask to enable the capability, and send N as is (including N==1). - teaching the sending side to see if the new behaviour to fix off-by-one is asked by the requestor, and stop at the correct number of commits, not oversending one more. Otherwise retain the old behaviour. In the longer term, I think we should introduce a better deepening mechanism. Cf. http://thread.gmane.org/gmane.comp.version-control.git/212912/focus=212940 Of course, one could using depth == 1 in this case to receive two commits and then drop one, but this would seem a bit pointless to me (especially if the commit below the tip is very different from the tip leading to a lot of useless data transfer). -- 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
Re: [PATCH 1/5] remote: trivial style cleanup
Felipe Contreras felipe.contre...@gmail.com writes: Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- remote.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/remote.c b/remote.c index 68eb99b..e71f66d 100644 --- a/remote.c +++ b/remote.c @@ -1474,8 +1474,7 @@ struct branch *branch_get(const char *name) ret-remote = remote_get(ret-remote_name); if (ret-merge_nr) { int i; - ret-merge = xcalloc(sizeof(*ret-merge), - ret-merge_nr); + ret-merge = xcalloc(ret-merge_nr, sizeof(*ret-merge)); Yeah, calloc is nmemb first and then size, so this makes sense. for (i = 0; i ret-merge_nr; i++) { ret-merge[i] = xcalloc(1, sizeof(**ret-merge)); ret-merge[i]-src = xstrdup(ret-merge_name[i]); -- 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
Re: [PATCH 4/5] test: improve rebase -q test
Felipe Contreras felipe.contre...@gmail.com writes: Let's show the output so it's clear why it failed. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- t/t3400-rebase.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index b58fa1a..fb39531 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -185,6 +185,7 @@ test_expect_success 'default to @{upstream} when upstream arg is missing' ' test_expect_success 'rebase -q is quiet' ' git checkout -b quiet topic git rebase -q master output.out 21 + cat output.out test ! -s output.out ' It is one thing to avoid squelching output that naturally comes out of command being tested unnecessarily, so that ./t-*.sh -v output can be used for debugging. I however am not sure if adding cat to random places like this is a productive direction for us to go in. A more preferrable alternative may be adding something like this to test-lib.sh and call it from here and elsewhere (there are about 50 places that do test ! -s filename), perhaps? test_must_be_an_empty_file () { if test -s $1 then cat $1 false fi } -- 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
Re: [PATCH 1/3] cherry-pick: add support to copy notes
Felipe Contreras felipe.contre...@gmail.com writes: Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- builtin/revert.c | 2 + sequencer.c | 136 -- sequencer.h | 2 + t/t3500-cherry.sh | 32 + 4 files changed, 169 insertions(+), 3 deletions(-) git cherry-pick should help maintaining notes just like amend and rebase, but how should this interact with notes.rewrite.command, where the command is capable of doing this without an explicit option once you tell which notes need to be maintained? Thomas Rast Cc'ed as he has been the primary force behind this line of notes usability. It probably is not sensible to carry over note from a reverted commit to its revert, but I didn't immediately spot how the patch does this only for cherry-pick but not for revert (the codepath in do_pick_commit() is shared between them, no?). diff --git a/builtin/revert.c b/builtin/revert.c index 0e5ce71..b977124 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -119,6 +119,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), OPT_END(), OPT_END(), + OPT_END(), }; if (opts-action == REPLAY_PICK) { @@ -129,6 +130,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_BOOLEAN(0, allow-empty-message, opts-allow_empty_message, N_(allow commits with empty messages)), OPT_BOOLEAN(0, keep-redundant-commits, opts-keep_redundant_commits, N_(keep redundant, empty commits)), OPT_BOOLEAN(0, skip-empty, opts-skip_empty, N_(skip empty commits)), + OPT_BOOLEAN(0, copy-notes, opts-copy_notes, N_(copy notes)), OPT_END(), }; if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra)) diff --git a/sequencer.c b/sequencer.c index edf141d..35a84ad 100644 --- a/sequencer.c +++ b/sequencer.c @@ -20,6 +20,18 @@ const char sign_off_header[] = Signed-off-by: ; static const char cherry_picked_prefix[] = (cherry picked from commit ; +struct rewritten_list_item { + unsigned char from[20]; + unsigned char to[20]; +}; + +struct rewritten_list { + struct rewritten_list_item *items; + unsigned int nr, alloc; +}; + +static struct rewritten_list rewritten; + static int is_rfc2822_line(const char *buf, int len) { int i; @@ -102,6 +114,40 @@ static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob, return 1; } +static void add_rewritten(unsigned char *from, unsigned char *to) +{ + struct rewritten_list_item *item; + if (rewritten.nr + 1 = rewritten.alloc) { + rewritten.alloc += 32; + rewritten.items = xrealloc(rewritten.items, rewritten.alloc * sizeof(*rewritten.items)); + } + item = rewritten.items[rewritten.nr]; + hashcpy(item-from, from); + hashcpy(item-to, to); + rewritten.nr++; +} + +static void copy_notes(void) +{ + unsigned char note_commit[20]; + struct strbuf buf = STRBUF_INIT; + struct notes_tree *t = default_notes_tree; + int i; + + init_notes(t, NULL, NULL, 0); + + for (i = 0; i rewritten.nr; i++) { + struct rewritten_list_item *item = rewritten.items[i]; + copy_note(t, item-from, item-to, 0, NULL); + } + + strbuf_addstr(buf, Notes added by 'git cherry-pick'\n); + create_notes_commit(default_notes_tree, NULL, buf, note_commit); + strbuf_insert(buf, 0, notes: , 7); + update_ref(buf.buf, t-ref, note_commit, NULL, 0, MSG_ON_ERR); + strbuf_release(buf); +} + static void remove_sequencer_state(void) { struct strbuf seq_dir = STRBUF_INIT; @@ -641,6 +687,14 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) res = run_git_commit(defmsg, opts, allow); } + if (!res opts-copy_notes) { + unsigned char to[20]; + + if (read_ref(HEAD, to)) + goto leave; + + add_rewritten(commit-object.sha1, to); + } leave: free_message(msg); free(defmsg); @@ -786,6 +840,40 @@ static void read_populate_todo(struct commit_list **todo_list, die(_(Unusable instruction sheet: %s), todo_file); } +static void read_populate_rewritten(void) +{ + const char *rewritten_file = git_path(SEQ_REWR_FILE); + struct strbuf buf = STRBUF_INIT; + char *p; + int fd; + + fd = open(rewritten_file, O_RDONLY); + if (fd 0) + return; + if (strbuf_read(buf, fd, 0) 0) { + close(fd); + strbuf_release(buf); + return; + } + close(fd); + + for (p = buf.buf; *p;) { +
where is the opensuse version for git?
Dear developer trying to find a version for suse 12.3 I was unable to locate a version. Please advise. downloading x-tags error messages. error message 504-gateway time out. Please advise what to do. regards Ludger -- 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
Re: [PATCH 0/5] rebase: improve the keep-empty
Hi, I think I have some patches at home that instead teach 'git am' the --keep-empty flag. Does that make sense? It's been a while since I looked at it, but I'll try to take a look tonight (PST). Martin On Tue, May 28, 2013 at 6:29 AM, Felipe Contreras felipe.contre...@gmail.com wrote: Hi, I've been analyzing 'git rebase' and found that the --keep-empty option triggers a very very different behavior. Here's a bunch of patches that make it behave like the 'am' does does for the most part. There's only a few minor changes, after which it might be possible to replace the whole 'am' mode to use cherr-pick instead. Felipe Contreras (5): rebase: split the cherry-pick stuff rebase: fix 'cherry' mode storage rebase: fix sequence continuation rebase: fix abort of cherry mode rebase: fix cherry-pick invocations .gitignore| 1 + Makefile | 1 + git-rebase--am.sh | 65 ++- git-rebase--cherry.sh | 55 +++ git-rebase.sh | 8 +++ 5 files changed, 93 insertions(+), 37 deletions(-) create mode 100644 git-rebase--cherry.sh -- 1.8.3.rc3.312.g47657de -- 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
Re: [PATCH 4/5] test: improve rebase -q test
Junio C Hamano wrote: A more preferrable alternative may be adding something like this to test-lib.sh and call it from here and elsewhere (there are about 50 places that do test ! -s filename), perhaps? test_must_be_an_empty_file () { if test -s $1 then cat $1 false fi } I generally just use the two-liner empty test_cmp empty output directly in cases like this. Thanks, Jonathan -- 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
Re: [PATCH] fix segfault with git log -c --follow
Clemens Buchacher dri...@aon.at writes: In diff_tree_combined we make a copy of diffopts. In try_to_follow_renames, called via diff_tree_sha1, we free and re-initialize diffopts-pathspec-items. Since we did not make a deep copy of diffopts in diff_tree_combined, the original diffopts does not get the update. By the time we return from diff_tree_combined, rev-diffopt-pathspec-items points to an invalid memory address. We get a segfault next time we try to access that pathspec. I am not quite sure if I follow. Do you mean diff_tree_combined() - makes a shallow copy of rev-diffopt - calls diff_tree_sha1() diff_tree_sha1() - tries to follow rename and clobbers diffopt - tries to use the shallow copy of original rev-diffopt that no longer is valid, which is a problem I wonder, just like we force recursive and disable external on the copy before we use it to call diff_tree_sha1(), if we should disable follow-renames on it. --follow is an option that is given to the history traversal part and it should not play any role in getting the pairwise diff with all parents diff_tree_combined() does. Besides, - --follow hack lets us keep track of only one path; and - -c and --cc make sense only when dealing with a merge commit and the path in the child may have come from different path in parents, so I am not sure if allowing combination of --follow -c/--cc makes much sense in the first place. -- 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
Re: [PATCH 4/5] test: improve rebase -q test
Jonathan Nieder jrnie...@gmail.com writes: Junio C Hamano wrote: A more preferrable alternative may be adding something like this to test-lib.sh and call it from here and elsewhere (there are about 50 places that do test ! -s filename), perhaps? test_must_be_an_empty_file () { if test -s $1 then cat $1 false fi } I generally just use the two-liner empty test_cmp empty output directly in cases like this. That would work, too. -- 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
Re: git hangs on pthread_join
On Thu, May 23, 2013 at 03:01:43PM +0200, Ian Kumlien wrote: git 1.8.2.1 is started by xinetd [...] I have found git receive-packs that has been running for days/weeks without terminating Attaching gdb and doing a trace results in: #0 0x003261207b35 in pthread_join () from /lib64/libpthread.so.0 #1 0x004ce58b in finish_async () #2 0x0045744b in cmd_receive_pack () #3 0x00404851 in handle_internal_command () #4 0x00404c9d in main () I recently fixed a deadlock that could happen in receive-pack when clients hung up before sending a valid pack header. The fix is commit 49ecfa1, and it's in git v1.8.2.2. The stack trace for the deadlock fixed by 49ecfa1 would have unpack_with_sideband between #1 and #2 above, but it is entirely possible that it is simply inlined in your build of git, depending on the -O level of your build (it is a static function that is only called from one place). So it seems likely that it is the culprit. -Peff -- 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
1.8.3 - gitignore not being parsed correctly on OS X; regex support is broken?
Hi, Gitignore parsing no longer seems to work properly in git 1.8.3. One of my repositories has the following gitignore: /* !/.gitignore !/Library/ !/CONTRIBUTING.md !/README.md !/SUPPORTERS.md !/bin /bin/* !/bin/brew !/share/man/man1/brew.1 .DS_Store /Library/LinkedKegs /Library/PinnedKegs /Library/Taps /Library/Formula/.gitignore In 1.8.2.3 and earlier, this works as expected. However, in 1.8.3 I'm seeing every file in /bin/ being marked as an untracked file. I asked about this in #git, and was told that the culprit was the regex support; apparently recompiling without regex support fixes the specific gitignore issue. However, this doesn't seem to have been reported anywhere on the mailing list that I can see. I was also told that the issue is OS X-specific, and doesn't happen on other platforms. Thanks, Misty De Meo -- 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
Re: [PATCH 1/3] cherry-pick: add support to copy notes
Junio C Hamano gits...@pobox.com writes: Thomas Rast Cc'ed as he has been the primary force behind this line of notes usability. Thanks for pointing this out to me. Felipe Contreras felipe.contre...@gmail.com writes: Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- builtin/revert.c | 2 + sequencer.c | 136 -- sequencer.h | 2 + t/t3500-cherry.sh | 32 + 4 files changed, 169 insertions(+), 3 deletions(-) git cherry-pick should help maintaining notes just like amend and rebase, but how should this interact with notes.rewrite.command, where the command is capable of doing this without an explicit option once you tell which notes need to be maintained? Since we already have the notes.rewrite.command convention, it would seem the obvious choice to line it up with the others. The main bikeshedding opportunity is whether this should be an exception and default to false (all other commands default it to true). Also: how does this interact with notes.rewriteRef and the corresponding env vars? Why? How does it interact with 'cherry-pick -n' if this is done in sequence, effectively squashing several commits (this use-case is actually suggested by the manpage), if multiple source commits had notes? Should it respect notes.rewriteMode (and by default concatenate)? (I don't know if the sequencer state is expressive enough already to carry this in a meaningful way across cherry-pick commands.) A commit message and some docs would be a nice idea, too. diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh index f038f34..79c1219 100755 --- a/t/t3500-cherry.sh +++ b/t/t3500-cherry.sh This file starts out with test_description='git cherry should detect patches integrated upstream This test cherry-picks one local change of two into master branch, and checks that git cherry only returns the second patch in the local branch ' So either your tests should go to a different file or the description becomes stale and needs to be updated. -- Thomas Rast trast@{inf,student}.ethz.ch -- 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
Re: [PATCH v2] difftool --dir-diff: always use identical working tree file
Kenichi Saita nito...@gmail.com writes: When deciding whether or not we should link a working tree file into the temporary right-hand directory for a directory diff, we currently behave differently in the --symlink and --no-symlink cases. If using symlinks any identical files are linked across but with --no-symlink only files that contain unstaged changes are copied back into the working tree. I may have missed an earlier discussion, but I do not follow the last sentence. The former part (i.e. symlinks) talks about what is done to populate the temporary tree (i.e. everything is linked), but the latter part (i.e. not symlinks) only talks about what is copied back, i.e. it is not a contrast between the behaviour of symlink vs no-symlink case wrt how the temporary tree is populated. Confused... Change this so that identical files are copied back as well. This is beneficial because it widens the set of circumstances in which we copy changes made by the user back into the working tree. Ah, OK, you meant that the set of files we keep in @working_tree array for later copying back are different between the two. Signed-off-by: Kenichi Saita nito...@gmail.com --- git-difftool.perl |9 ++--- t/t7800-difftool.sh | 19 +++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/git-difftool.perl b/git-difftool.perl index 8a75205..e57d3d1 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -85,13 +85,9 @@ sub exit_cleanup sub use_wt_file { - my ($repo, $workdir, $file, $sha1, $symlinks) = @_; + my ($repo, $workdir, $file, $sha1) = @_; my $null_sha1 = '0' x 40; - if ($sha1 ne $null_sha1 and not $symlinks) { - return 0; - } - if (! -e $workdir/$file) { # If the file doesn't exist in the working tree, we cannot # use it. @@ -213,8 +209,7 @@ EOF if ($rmode ne $null_mode) { my ($use, $wt_sha1) = use_wt_file($repo, $workdir, - $dst_path, $rsha1, - $symlinks); + $dst_path, $rsha1); if ($use) { push @working_tree, $dst_path; $wtindex .= $rmode $wt_sha1\t$dst_path\0; diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index d46f041..2418528 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -385,6 +385,25 @@ test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstage test_cmp actual expect ' +write_script modify-right-file \EOF +echo new content $2/file +EOF + +run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' ' + test_when_finished git reset --hard + echo orig content file + git difftool -d $symlinks --extcmd $(pwd)/modify-right-file branch + echo new content expect + test_cmp expect file +' + +run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' ' + test_when_finished git reset --hard + git difftool -d $symlinks --extcmd $(pwd)/modify-right-file branch + echo new content expect + test_cmp expect file +' + write_script modify-file \EOF echo new content file EOF -- 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
Re: [PATCH] git-remote-mediawiki: better error message when HTTP(S) access fails
On Thu, May 23, 2013 at 10:05:03PM +0200, Matthieu Moy wrote: My use-case is an invalid SSL certificate. Pulling from the wiki with a recent version of libwww-perl fails, and git-remote-mediawiki gave no clue about the reason. Give the mediawiki API detailed error message, and since it is not so informative, hint the user about an invalid SSL certificate on https:// urls. This is definitely an improvement, but it seems like it just the tip of the iceberg. The call in get_mw_tracked_categories already uses die() with the MW error code and detailed string. Good. The call you fix here prints a guess to stderr and exits 1, and your patch improves that. But the call in get_mw_first_pages does the same broken thing, and is not fixed. Ditto for get_all_mediafiles. Other calls do not even seem to error check the result at all, and assume the result is not undef (which I suspect would produce a perl runtime error). I wonder if we can do something like: our $mw_operation; $mediawiki-{config}-{on_error} = sub { my $err = fatal: ; if (defined $mw_operation) { $err .= unable to $mw_operation: ; } err .= $mediawiki-{error}-{details}; die $err\n; }; and then callers do not have to worry about error-checking at all. If they want a nicer human-readable indication of where the error occured, they can do: local $mw_operation = get the list of remote wiki pages; my $mw_pages = $mediawiki-list(...); -Peff -- 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
Re: [PATCH v2] difftool --dir-diff: always use identical working tree file
On Tue, May 28, 2013 at 11:06:13AM -0700, Junio C Hamano wrote: Kenichi Saita nito...@gmail.com writes: When deciding whether or not we should link a working tree file into the temporary right-hand directory for a directory diff, we currently behave differently in the --symlink and --no-symlink cases. If using symlinks any identical files are linked across but with --no-symlink only files that contain unstaged changes are copied back into the working tree. I may have missed an earlier discussion, but I do not follow the last sentence. The former part (i.e. symlinks) talks about what is done to populate the temporary tree (i.e. everything is linked), but the latter part (i.e. not symlinks) only talks about what is copied back, i.e. it is not a contrast between the behaviour of symlink vs no-symlink case wrt how the temporary tree is populated. Confused... Yeah, the commit message is still quite focused on the end effect of copying files back. But that's not what's being changed here. In my suggested commit message I tried to make it clear that we're changing when we decide to copy a file across to the temporary tree. This has the beneficial (side-)effect of changing the set of files we consider for copying back into the working tree after the diff tool has been run. Change this so that identical files are copied back as well. This is beneficial because it widens the set of circumstances in which we copy changes made by the user back into the working tree. Ah, OK, you meant that the set of files we keep in @working_tree array for later copying back are different between the two. Signed-off-by: Kenichi Saita nito...@gmail.com --- git-difftool.perl |9 ++--- t/t7800-difftool.sh | 19 +++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/git-difftool.perl b/git-difftool.perl index 8a75205..e57d3d1 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -85,13 +85,9 @@ sub exit_cleanup sub use_wt_file { - my ($repo, $workdir, $file, $sha1, $symlinks) = @_; + my ($repo, $workdir, $file, $sha1) = @_; my $null_sha1 = '0' x 40; - if ($sha1 ne $null_sha1 and not $symlinks) { - return 0; - } - if (! -e $workdir/$file) { # If the file doesn't exist in the working tree, we cannot # use it. @@ -213,8 +209,7 @@ EOF if ($rmode ne $null_mode) { my ($use, $wt_sha1) = use_wt_file($repo, $workdir, - $dst_path, $rsha1, - $symlinks); + $dst_path, $rsha1); if ($use) { push @working_tree, $dst_path; $wtindex .= $rmode $wt_sha1\t$dst_path\0; diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index d46f041..2418528 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -385,6 +385,25 @@ test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstage test_cmp actual expect ' +write_script modify-right-file \EOF +echo new content $2/file +EOF + +run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' ' + test_when_finished git reset --hard + echo orig content file + git difftool -d $symlinks --extcmd $(pwd)/modify-right-file branch + echo new content expect + test_cmp expect file +' + +run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' ' + test_when_finished git reset --hard + git difftool -d $symlinks --extcmd $(pwd)/modify-right-file branch + echo new content expect + test_cmp expect file +' + write_script modify-file \EOF echo new content file EOF -- 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 -- 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
Re: [PATCH v2] difftool --dir-diff: always use identical working tree file
John Keeping j...@keeping.me.uk writes: Yeah, the commit message is still quite focused on the end effect of copying files back. But that's not what's being changed here. In my suggested commit message I tried to make it clear that we're changing when we decide to copy a file across to the temporary tree. This has the beneficial (side-)effect of changing the set of files we consider for copying back into the working tree after the diff tool has been run. I actually think the effect of copying files back _is_ the primary motivation of this change, and stressing that end effect is a much better description. After all, if the working tree files do not have any difference from the RHS of the comparison, copying from the working tree and stuffing the $rsha1 to the RHS temporary index and running checkout -f should produce identical temporary directory for the user to start viewing. The _only_ difference in behaviour before and after this patch that matters to the end user is if that path is in @working_tree, which is returned to @worktree of dir_diff sub to be later copied back, no? I would view this change as a mere means, an implementation detail, to achieve that end of stuffing more paths in the @worktree array. Perhaps difftool --dir-diff: allow changing any clean working tree file The temporary directory prepared by difftool --dir-diff to show the result of a change can be modified by the user via the tree diff program, and we try hard not to lose changes to them after tree diff program returns to us. However, the set of files to be copied back is computed differently between --symlinks and --no-symlinks modes. The former checks all paths that start out as identical to the working tree file, while the latter checks paths that already had a local modification in the working tree, allowing changes made in the tree diff program to paths that did not have any local change to be lost. or something. This invites a few questions, though. - By allowing these files in the temporary directory to be modified, aren't we making the user's life harder by forcing them to handle working tree file was already modified, made different changes in the temporary directory, now these changes need to be consolidated case? - When comparing two revisions, e.g. --dir-diff HEAD^^ HEAD^, that checks out (via $rsha1 to checkout -f codepath) a blob that does not match what is in the working tree of HEAD to the temporary directory, we still allow modifications to the copy in the temporary directory, but what can the user do with these changes that are _not_ based on HEAD, short of checking out HEAD^ and apply the difference first? I still cannot shake this nagging feeling that giving a writable temporary directory might have been a mistake in the first place. Perhaps it may be a better design to make the ones that the user shouldn't touch (or will lead to the above confusion) read-only, while the ones that match the working tree read-write? -- 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
Re: [PATCH v2] difftool --dir-diff: always use identical working tree file
On Tue, May 28, 2013 at 11:57:08AM -0700, Junio C Hamano wrote: John Keeping j...@keeping.me.uk writes: Yeah, the commit message is still quite focused on the end effect of copying files back. But that's not what's being changed here. In my suggested commit message I tried to make it clear that we're changing when we decide to copy a file across to the temporary tree. This has the beneficial (side-)effect of changing the set of files we consider for copying back into the working tree after the diff tool has been run. I actually think the effect of copying files back _is_ the primary motivation of this change, and stressing that end effect is a much better description. After all, if the working tree files do not have any difference from the RHS of the comparison, copying from the working tree and stuffing the $rsha1 to the RHS temporary index and running checkout -f should produce identical temporary directory for the user to start viewing. The _only_ difference in behaviour before and after this patch that matters to the end user is if that path is in @working_tree, which is returned to @worktree of dir_diff sub to be later copied back, no? I would view this change as a mere means, an implementation detail, to achieve that end of stuffing more paths in the @worktree array. I agree with this, but like you I found it confusing that the patch touched code seemingly unrelated to copying files back. I went toward describing the patch more literally and giving the motivation in the final paragraph. Your message below is better, but I think it needs to say that the set of files considered for copying back is the set that is copied across to begin with. Perhaps difftool --dir-diff: allow changing any clean working tree file The temporary directory prepared by difftool --dir-diff to show the result of a change can be modified by the user via the tree diff program, and we try hard not to lose changes to them after tree diff program returns to us. However, the set of files to be copied back is computed differently between --symlinks and --no-symlinks modes. The former checks all paths that start out as identical to the working tree file, while the latter checks paths that already had a local modification in the working tree, allowing changes made in the tree diff program to paths that did not have any local change to be lost. or something. This invites a few questions, though. - By allowing these files in the temporary directory to be modified, aren't we making the user's life harder by forcing them to handle working tree file was already modified, made different changes in the temporary directory, now these changes need to be consolidated case? - When comparing two revisions, e.g. --dir-diff HEAD^^ HEAD^, that checks out (via $rsha1 to checkout -f codepath) a blob that does not match what is in the working tree of HEAD to the temporary directory, we still allow modifications to the copy in the temporary directory, but what can the user do with these changes that are _not_ based on HEAD, short of checking out HEAD^ and apply the difference first? I still cannot shake this nagging feeling that giving a writable temporary directory might have been a mistake in the first place. Perhaps it may be a better design to make the ones that the user shouldn't touch (or will lead to the above confusion) read-only, while the ones that match the working tree read-write? My ideal scenario would be that we only allow users to edit files when they are comparing against the working tree, but that would require git-difftool to fully understand all git-diff options since it just passes through any it doesn't recognise. I don't think there's an easy way to do that, which leaves us with this confusing situation. -- 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
Re: [PATCH v2] difftool --dir-diff: always use identical working tree file
John Keeping j...@keeping.me.uk writes: - When comparing two revisions, e.g. --dir-diff HEAD^^ HEAD^, that checks out (via $rsha1 to checkout -f codepath) a blob that does not match what is in the working tree of HEAD to the temporary directory, we still allow modifications to the copy in the temporary directory, but what can the user do with these changes that are _not_ based on HEAD, short of checking out HEAD^ and apply the difference first? I still cannot shake this nagging feeling that giving a writable temporary directory might have been a mistake in the first place. Perhaps it may be a better design to make the ones that the user shouldn't touch (or will lead to the above confusion) read-only, while the ones that match the working tree read-write? My ideal scenario would be that we only allow users to edit files when they are comparing against the working tree, but that would require git-difftool to fully understand all git-diff options since it just passes through any it doesn't recognise. I don't think there's an easy way to do that, which leaves us with this confusing situation. Not necessarily. Let's assume that changing files in diff tool is a sensible thing to do, as long as we make sure such a change is not lost (which I may not 100% agree with, but let's put it aside for now). When you are viewing a file F in --dir-diff HEAD^^ HEAD^, if there is no change for F in between HEAD^ and HEAD and you notice a typo that may or may not be related to the differences between HEAD^^ and HEAD^, it would be tempting to fix that right there. And as long as F in the working tree matches that of HEAD^ and the modification you make in the temporary directory gets copied back to the working tree, your typofix will end up to be in the working tree. Which I _think_ is what people, who want to change files in diff tool, want to do. Of course, your working tree may have been in the middle of doing something entirely different and you may have to add [-p] to separate such a typofix with other changes you were working on, but that is a separate issue. And for that to work, the only think you need is does the blob we show on the RHS temporary tree match what is in the working tree? check. You do not need to know or care if you are comparing two old revisions, etc. -- 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
Re: [PATCH 2/4] remote-helpers: rename tests
Felipe Contreras felipe.contre...@gmail.com writes: The .t extension is more standard for sharness tests. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Is that sharness test the sh script testsuite forked from our testsuite? I do not see how it makes sense to copy how they deviate from us back to our codebase, especially if we plan to eventually move some of these tests out of contrib/ area, but even without such a plan in the future. contrib/remote-helpers/Makefile| 2 +- contrib/remote-helpers/{test-bzr.sh = test-bzr.t} | 0 contrib/remote-helpers/{test-hg-bidi.sh = test-hg-bidi.t} | 0 contrib/remote-helpers/{test-hg-hg-git.sh = test-hg-hg-git.t} | 0 contrib/remote-helpers/{test-hg.sh = test-hg.t} | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename contrib/remote-helpers/{test-bzr.sh = test-bzr.t} (100%) rename contrib/remote-helpers/{test-hg-bidi.sh = test-hg-bidi.t} (100%) rename contrib/remote-helpers/{test-hg-hg-git.sh = test-hg-hg-git.t} (100%) rename contrib/remote-helpers/{test-hg.sh = test-hg.t} (100%) diff --git a/contrib/remote-helpers/Makefile b/contrib/remote-helpers/Makefile index d9b3515..2c91ec6 100644 --- a/contrib/remote-helpers/Makefile +++ b/contrib/remote-helpers/Makefile @@ -1,4 +1,4 @@ -TESTS := $(wildcard test*.sh) +TESTS := $(wildcard test-*.t) SCRIPTS := $(wildcard git-remote-*.py) export T := $(addprefix $(CURDIR)/,$(TESTS)) diff --git a/contrib/remote-helpers/test-bzr.sh b/contrib/remote-helpers/test-bzr.t similarity index 100% rename from contrib/remote-helpers/test-bzr.sh rename to contrib/remote-helpers/test-bzr.t diff --git a/contrib/remote-helpers/test-hg-bidi.sh b/contrib/remote-helpers/test-hg-bidi.t similarity index 100% rename from contrib/remote-helpers/test-hg-bidi.sh rename to contrib/remote-helpers/test-hg-bidi.t diff --git a/contrib/remote-helpers/test-hg-hg-git.sh b/contrib/remote-helpers/test-hg-hg-git.t similarity index 100% rename from contrib/remote-helpers/test-hg-hg-git.sh rename to contrib/remote-helpers/test-hg-hg-git.t diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.t similarity index 100% rename from contrib/remote-helpers/test-hg.sh rename to contrib/remote-helpers/test-hg.t -- 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
Re: [PATCH 4/4] remote-helpers: add exec-path links
Felipe Contreras felipe.contre...@gmail.com writes: This way we don't have to modify the PATH ourselves and it's easier to test without 'make'. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- .gitignore | 2 ++ contrib/remote-helpers/Makefile | 13 + 2 files changed, 11 insertions(+), 4 deletions(-) If we teach the top-level .gitignore that some contrib/ stuff might contaminate the top-level directory (which is a good idea), we should also teach the top-level Makefile how to get rid of the built cruft upon make clean, no? diff --git a/.gitignore b/.gitignore index 10aee94..a79b412 100644 --- a/.gitignore +++ b/.gitignore @@ -119,11 +119,13 @@ /git-reflog /git-relink /git-remote +/git-remote-bzr /git-remote-http /git-remote-https /git-remote-ftp /git-remote-ftps /git-remote-fd +/git-remote-hg /git-remote-ext /git-remote-testgit /git-remote-testpy diff --git a/contrib/remote-helpers/Makefile b/contrib/remote-helpers/Makefile index 55abf0b..98150b4 100644 --- a/contrib/remote-helpers/Makefile +++ b/contrib/remote-helpers/Makefile @@ -1,9 +1,9 @@ TESTS := $(wildcard test-*.t) SCRIPTS := $(wildcard git-remote-*.py) +LINKS := $(addprefix ../../,$(patsubst %.py,%,$(SCRIPTS))) export T := $(addprefix $(CURDIR)/,$(TESTS)) export MAKE := $(MAKE) -e -export PATH := $(CURDIR):$(PATH) export TEST_LINT := test-lint-executable test-lint-shell-syntax export TEST_DIRECTORY := $(CURDIR)/../../t @@ -15,10 +15,15 @@ all: $(SCRIPTS) install: $(MAKE) -C ../.. install-python-script -test: all +links: all $(LINKS) + +test: links $(MAKE) -C ../../t $@ -$(TESTS): all +$(LINKS): + ln -sf contrib/remote-helpers/$(notdir $@) ../.. + +$(TESTS): links $(MAKE) -C ../../t $(CURDIR)/$@ -.PHONY: all install test $(TESTS) +.PHONY: all install test links $(TESTS) -- 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
Re: git clone does not understand insteadOf URLs
Andreas Schwab sch...@linux-m68k.org writes: Gioele Barabucci gio...@svario.it writes: Simple, I keep all my projects on the same server, so I would like to refer to that server + path using 'remote-repo'. git+ssh://git.example.org//users/gioele/projects insteadOf remote-repo You can use remote-repo: instead. That with colon is pretty much how it was designed to be used, but the code did not insist that the insteadof has at least the scheme part, and by mistake allowed something like this [url k.org:/pub/scm/git] insteadOf = g to be used with g/foo to expand to k.org:/pub/scm/git/foo. But if git fetch g/foo with such a configuration happily goes to k.org:/pub/scm/git/foo without problems, then I think it is very reasonable to delay the is that a local filename? short-cut git clone does and let the insteadof URL expand take place before it. -- 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
Re: contrib/git-normal-to-bare.sh
Zenaan Harkness z...@freedbms.net writes: I needed this quite a bit in the last few days, basic script but serves my need. I think it would be useful for other beginners if in $git/contrib/ source dir. Just a start to a basic script. Needs more tests etc, but it's enough to get newbies (like me) off to a reasonable start. Handles multiple input dirs. PLEASE CC me, as I am not subscribed. (some SMTP server rejected attachment, so pasting below instead) Thanks, Zenaan #!/bin/bash I do not think you need (nor used) any bash-ism in this script. Saying #!/bin/sh here is cleaner. # Change one or more normal repos into bare repos: # See also https://git.wiki.kernel.org/index.php/GitFaq#How_do_I_make_existing_non-bare_repository_bare.3F for i in $@; do for i do You do not have to say 'in $@'; it is implied. echo; echo -- echo Processing $i Forgot to dq? repo=$i repo=`basename $i` tmp_repo=${repo}.git # Insert here: may be exit if any spaces in repo fqn # Insert here: check for non-existent repo/.git dir # Insert here: check that we are not inside the repo # Insert here: add exit/do-nothing if fail to mv dirs etc mv $repo/.git $tmp_repo Forgot to dq? i.e. mv $repo/.git $tmp_repo The same for all the variable references in the remainder of the script. More importantly, mv would fail if $repo is given as a full pathname elsewhere in the filesystem that is different from your current directory where you create $tmp_repo. git --git-dir=$tmp_repo config core.bare true mv $repo ${repo}.bak mv $tmp_repo $repo done -- 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
Re: What's cooking in git.git (May 2013, #04; Wed, 15)
Duy Nguyen pclo...@gmail.com writes: Point taken. I guess the message would be something like this? Refname '%.*s' is ignored. It may be created by mistake. Or should we be more elaborate? I dunno; with s/may be/may have been/, I think it is better than refname is ambiguous. -- 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
Re: 1.8.3 - gitignore not being parsed correctly on OS X; regex support is broken?
Misty De Meo misty at brew.sh writes: Hi, Gitignore parsing no longer seems to work properly in git 1.8.3. One of my repositories has the following gitignore: /* !/.gitignore !/Library/ !/CONTRIBUTING.md !/README.md !/SUPPORTERS.md !/bin /bin/* !/bin/brew !/share/man/man1/brew.1 .DS_Store /Library/LinkedKegs /Library/PinnedKegs /Library/Taps /Library/Formula/.gitignore In 1.8.2.3 and earlier, this works as expected. However, in 1.8.3 I'm seeing every file in /bin/ being marked as an untracked file. I asked about this in #git, and was told that the culprit was the regex support; apparently recompiling without regex support fixes the specific gitignore issue. However, this doesn't seem to have been reported anywhere on the mailing list that I can see. I was also told that the issue is OS X-specific, and doesn't happen on other platforms. Thanks, Misty De Meo I see a similar problem using e.g. the following .gitignore to exclude everything except C source files and header files: * !*/ !*.c !*.h In Git 1.8.3 'git status' will show other files as untracked while in Git 1.8.2.3 I don't have that problem. I bisected to find that the offending commit is v1.8.2.1-402-g95c6f27. I am not on OSX, however, but on Linux (Ubuntu 12.04 and RHEL 5.8) so this may be a separate issue. I've also gotten the impression that this is intentional. In any case I cannot create a .gitignore that achieves the same for both older and newer versions of Git. Best regards, Øystein Walle -- 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
What's cooking in git.git (May 2013, #08; Tue, 28)
Here are the topics that have been cooking. Commits prefixed with '-' are only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'. There are topics that are still in 'next', not because they needed more testing, but only because we already were in the -rc period. Now that 1.8.3 is out, we will start merging them to 'master' (and some to 'maint' for 1.8.3.1) probably tomorrow (i.e. after waiting for a few days to make sure we can have a clean start of the post 1.8.3 maint branch with brown paper bag fixes and nothing else). The post 1.8.3 cycle will start early next month, at which time the 'next' branch will be rewound and rebuilt. Until then, I expect that my patch queue may stay slow and leaky while I take a bit of break. You can find the changes described here in the integration branches of the repositories listed at http://git-blame.blogspot.com/p/git-public-repositories.html -- [New Topics] * nd/urls-doc-no-file-hyperlink-fix (2013-05-24) 1 commit - urls.txt: avoid auto converting to hyperlink Will merge to 'next'. * cb/log-follow-with-combined (2013-05-28) 1 commit - fix segfault with git log -c --follow Will merge to 'next'. * fc/cleanups (2013-05-28) 3 commits - test: rebase: fix --interactive test - test: trivial cleanups - remote: trivial style cleanup Will merge to 'next'. * fc/makefile (2013-05-26) 5 commits - build: do not install git-remote-testpy - build: add NO_INSTALL variable - build: cleanup using $ - build: cleanup using $^ - build: trivial simplification (this branch is used by fc/remote-helpers-use-specified-python.) Will merge to 'next'. * fc/remote-helpers-use-specified-python (2013-05-28) 4 commits - remote-helpers: add exec-path links - remote-helpers: allow direct test execution - remote-helpers: rename tests - remote-helpers: generate scripts (this branch uses fc/makefile.) I do not particularly think the second from the bottom is a good change, but it takes the remainder of the series hostage. Will hopefully be rerolled without it. * fc/send-email-chainreplyto-warning (2013-05-28) 1 commit - send-email: remove warning about unset chainreplyto An overdue removal od behaviour changed at 1.7.0; if you were living in a cave, here is what you can adjust to it message. Will merge to 'next'. * ks/difftool-dirdiff-copy-all (2013-05-28) 1 commit - difftool --dir-diff: always use identical working tree file difftool --dir-diff populates a temporary directory with files, inviting the user to modify them in place, but in some cases we weren't expecting the user to modify them and did not take the change back to the working tree. The log message has room for clarification, but the change looked sane. * nd/prune-packed-dryrun-verbose (2013-05-28) 1 commit - prune-packed: avoid implying 1 is DRY_RUN in prune_packed_objects() Will merge to 'next'. * rj/mingw-compat-st-mode-bits (2013-05-28) 1 commit - path: Fix a sparse warning Will merge to 'next'. * rs/commit-m-no-edit (2013-05-28) 1 commit - commit: don't start editor if empty message is given with -m Will merge to 'next'. * xq/credential-osxkeychain (2013-05-28) 1 commit - credential-osxkeychain: support more protocols Will merge to 'next'. * jc/core-checkstat (2013-05-06) 1 commit - deprecate core.statinfo at Git 2.0 boundary (this branch is used by jc/core-checkstat-2.0.) Will merge to 'next'. -- [Stalled] * rr/rebase-autostash (2013-05-12) 7 commits - rebase: implement --[no-]autostash and rebase.autostash - rebase --merge: return control to caller, for housekeeping - rebase -i: return control to caller, for housekeeping - am: return control to caller, for housekeeping - rebase: prepare to do generic housekeeping - rebase -i: don't error out if $state_dir already exists - am: tighten a conditional that checks for $dotest This is from v3, but after a Fixed message in $gmane/224111 we haven't seen a reroll yet. Also there was an attempt for a follow-up, but it was never completed. * rj/mingw-cygwin (2013-05-08) 2 commits - cygwin: Remove the CYGWIN_V15_WIN32API build variable - mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE Update build for Cygwin 1.[57]. There seems to have been some discussion but did anything concrete come out of it??? * mh/multimail (2013-04-21) 1 commit - git-multimail: a replacement for post-receive-email Waiting for the initial history to pull from. $gmane/223564 * jc/format-patch (2013-04-22) 2 commits - format-patch: --inline-single - format-patch: rename no_inline field A new option to send a single patch to the standard output to be appended at the bottom of a message. I personally have no need for this, but it was easy enough to cobble together. Tests, docs and stripping out more MIMEy stuff are left as exercises to interested parties. Not ready for
Re: 1.8.3 - gitignore not being parsed correctly on OS X; regex support is broken?
Øystein Walle oys...@gmail.com writes: Misty De Meo misty at brew.sh writes: Hi, Gitignore parsing no longer seems to work properly in git 1.8.3. One of my repositories has the following gitignore: /* !/.gitignore !/Library/ !/CONTRIBUTING.md !/README.md !/SUPPORTERS.md !/bin /bin/* !/bin/brew !/share/man/man1/brew.1 .DS_Store /Library/LinkedKegs /Library/PinnedKegs /Library/Taps /Library/Formula/.gitignore In 1.8.2.3 and earlier, this works as expected. However, in 1.8.3 I'm seeing every file in /bin/ being marked as an untracked file. I asked about this in #git, and was told that the culprit was the regex support; apparently recompiling without regex support fixes the specific gitignore issue. However, this doesn't seem to have been reported anywhere on the mailing list that I can see. I was also told that the issue is OS X-specific, and doesn't happen on other platforms. Thanks, Misty De Meo I see a similar problem using e.g. the following .gitignore to exclude everything except C source files and header files: * !*/ !*.c !*.h In Git 1.8.3 'git status' will show other files as untracked while in Git 1.8.2.3 I don't have that problem. I bisected to find that the offending commit is v1.8.2.1-402-g95c6f27. I am not on OSX, however, but on Linux (Ubuntu 12.04 and RHEL 5.8) so this may be a separate issue. I've also gotten the impression that this is intentional. In any case I cannot create a .gitignore that achieves the same for both older and newer versions of Git. Thanks; 95c6f27 is from Karsten and I think Duy is the most clueful one in this area in the discussion that had this change; I am forwarding this message to them. Cf. http://thread.gmane.org/gmane.comp.version-control.git/218440/focus=221289 -- 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
Re: [PATCH 1/5] rebase: split the cherry-pick stuff
Felipe Contreras felipe.contre...@gmail.com writes: They do something completely different from 'git am', it belongs in a different file. I would prefer to see it called --cherry-pick, not --cherry, as they are different commands (the latter may be useful when deciding which one to use the former). Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- .gitignore| 1 + Makefile | 1 + git-rebase--am.sh | 65 ++- git-rebase--cherry.sh | 34 +++ git-rebase.sh | 4 5 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 git-rebase--cherry.sh diff --git a/.gitignore b/.gitignore index 6669bf0..284fc8f 100644 --- a/.gitignore +++ b/.gitignore @@ -113,6 +113,7 @@ /git-read-tree /git-rebase /git-rebase--am +/git-rebase--cherry /git-rebase--interactive /git-rebase--merge /git-receive-pack diff --git a/Makefile b/Makefile index 0f931a2..a3cd4bc 100644 --- a/Makefile +++ b/Makefile @@ -469,6 +469,7 @@ SCRIPT_SH += git-web--browse.sh SCRIPT_LIB += git-mergetool--lib SCRIPT_LIB += git-parse-remote SCRIPT_LIB += git-rebase--am +SCRIPT_LIB += git-rebase--cherry SCRIPT_LIB += git-rebase--interactive SCRIPT_LIB += git-rebase--merge SCRIPT_LIB += git-sh-setup diff --git a/git-rebase--am.sh b/git-rebase--am.sh index f84854f..ee1b1b9 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -19,52 +19,43 @@ esac test -n $rebase_root root_flag=--root ret=0 +rm -f $GIT_DIR/rebased-patches - cat 2 -EOF +git format-patch -k --stdout --full-index --ignore-if-in-upstream \ + --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \ + $root_flag $revisions $GIT_DIR/rebased-patches +ret=$? +if test 0 != $ret +then + rm -f $GIT_DIR/rebased-patches + case $head_name in + refs/heads/*) + git checkout -q $head_name + ;; + *) + git checkout -q $orig_head + ;; + esac - $revisions + cat 2 -EOF + git encountered an error while preparing the patches to replay + these revisions: + $revisions + As a result, git cannot rebase them. + EOF + exit $? fi +git am $git_am_opt --rebasing --resolvemsg=$resolvemsg $GIT_DIR/rebased-patches +ret=$? + +rm -f $GIT_DIR/rebased-patches + if test 0 != $ret then test -d $state_dir write_basic_state OK, this part seems a straightforward reindentation of else side. diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh new file mode 100644 index 000..cbf80f9 --- /dev/null +++ b/git-rebase--cherry.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Copyright (c) 2010 Junio C Hamano. +# + +case $action in +continue) + git am --resolved --resolvemsg=$resolvemsg + move_to_original_branch + exit + ;; +skip) + git am --skip --resolvemsg=$resolvemsg + move_to_original_branch + exit + ;; +esac + +test -n $rebase_root root_flag=--root Hmm, do we want to duplicate this part between the two? Perhaps it will be unified in a later patch---I'll read on. +# we have to do this the hard way. git format-patch completely squashes +# empty commits and even if it didn't the format doesn't really lend +# itself well to recording empty patches. fortunately, cherry-pick +# makes this easy +git cherry-pick --allow-empty $revisions +ret=$? + +if test 0 != $ret +then + test -d $state_dir write_basic_state + exit $ret +fi + +move_to_original_branch OK. This is the then side of the original, with clean-up phase copied. diff --git a/git-rebase.sh b/git-rebase.sh index 2c692c3..2754985 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -379,6 +379,10 @@ elif test -n $do_merge then type=merge state_dir=$merge_dir +elif test -n $keep_empty +then + type=cherry + state_dir=$apply_dir else type=am state_dir=$apply_dir -- 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
Re: [PATCH 2/5] rebase: fix 'cherry' mode storage
Felipe Contreras felipe.contre...@gmail.com writes: We don't use the 'rebase-apply'. s/.$/; we will use rebase-merge instead./ I think. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 4 git-rebase.sh | 5 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index cbf80f9..ab1f8b7 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -18,6 +18,9 @@ esac test -n $rebase_root root_flag=--root +mkdir $state_dir || die Could not create temporary $state_dir +: $state_dir/cherry || die Could not mark as cherry Style: $state_dir/cherry-pick I am not sure if the user _cares_ that internally we use cherry-pick when s/he asks us to do a keep-empty, and I suspect mark as cherry incomprehensible. I do not even know what is going on at this point (yet). I _suspect_ that you are using cherry-pick when --keep-empty is given, so it might even make sense to talk in the end-users' terms, i.e. call this $state_dir/keep-empty (I am not sure if calling this split half git-rebase--keep-empty.sh makes sense, yet). + # we have to do this the hard way. git format-patch completely squashes # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick @@ -32,3 +35,4 @@ then fi move_to_original_branch +rm -rf $state_dir diff --git a/git-rebase.sh b/git-rebase.sh index 2754985..b7759d5 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -174,6 +174,9 @@ then then type=interactive interactive_rebase=explicit + elif test -f $merge_dir/cherry + then + type=cherry else type=merge fi @@ -382,7 +385,7 @@ then elif test -n $keep_empty then type=cherry - state_dir=$apply_dir + state_dir=$merge_dir else type=am state_dir=$apply_dir -- 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
Re: [PATCH 3/5] rebase: fix sequence continuation
Felipe Contreras felipe.contre...@gmail.com writes: We are not in am mode. That may make sense, but shouldn't this part be like so from the very beginning? In other words, this looks like an oops, 1/5 was buggy and this is a hotfix. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index ab1f8b7..ca78b1b 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -5,13 +5,15 @@ case $action in continue) - git am --resolved --resolvemsg=$resolvemsg - move_to_original_branch + git cherry-pick --continue + move_to_original_branch + rm -rf $state_dir exit ;; skip) - git am --skip --resolvemsg=$resolvemsg - move_to_original_branch + git cherry-pick --skip + move_to_original_branch + rm -rf $state_dir exit ;; esac -- 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
Re: [PATCH 5/5] rebase: fix cherry-pick invocations
Felipe Contreras felipe.contre...@gmail.com writes: So that all the tests pass. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index ca78b1b..c3a2ac9 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -23,11 +23,26 @@ test -n $rebase_root root_flag=--root mkdir $state_dir || die Could not create temporary $state_dir : $state_dir/cherry || die Could not mark as cherry +if test -n $rebase_root +then + revisions=$onto...$orig_head +else + revisions=$upstream...$orig_head +fi So that all the tests pass needs a bit more explanation to say for cherry-pick codepath why and how two-dot range fails and why and how three-dot variant with --right-only fixes it. What are the problematic cases? # we have to do this the hard way. git format-patch completely squashes # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy -git cherry-pick --allow-empty $revisions +if test -n $keep_empty +then + extra=--allow-empty +else + extra=--skip-empty --cherry-pick +fi +test -n $GIT_QUIET extra=$extra -q +test -z $force_rebase extra=$extra --ff +git cherry-pick --no-merges --right-only --topo-order --do-walk --copy-notes $extra $revisions ret=$? if test 0 != $ret -- 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
Re: [PATCH 5/5] rebase: fix cherry-pick invocations
Junio C Hamano gits...@pobox.com writes: Felipe Contreras felipe.contre...@gmail.com writes: So that all the tests pass. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index ca78b1b..c3a2ac9 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -23,11 +23,26 @@ test -n $rebase_root root_flag=--root mkdir $state_dir || die Could not create temporary $state_dir : $state_dir/cherry || die Could not mark as cherry +if test -n $rebase_root +then +revisions=$onto...$orig_head +else +revisions=$upstream...$orig_head +fi So that all the tests pass needs a bit more explanation to say for cherry-pick codepath why and how two-dot range fails and why and how three-dot variant with --right-only fixes it. What are the problematic cases? Yikes, sorry, this was me being slow. Walking A...B range with right-only and --cherry applied will filter the duplicates, which is wat you want, I think, and walking A..B range will not do the filtering for you. # we have to do this the hard way. git format-patch completely squashes # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy -git cherry-pick --allow-empty $revisions +if test -n $keep_empty +then +extra=--allow-empty +else +extra=--skip-empty --cherry-pick +fi +test -n $GIT_QUIET extra=$extra -q +test -z $force_rebase extra=$extra --ff +git cherry-pick --no-merges --right-only --topo-order --do-walk --copy-notes $extra $revisions ret=$? if test 0 != $ret -- 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
Re: [PATCH] fix segfault with git log -c --follow
On Tue, May 28, 2013 at 10:22:17AM -0700, Junio C Hamano wrote: Clemens Buchacher dri...@aon.at writes: In diff_tree_combined we make a copy of diffopts. In try_to_follow_renames, called via diff_tree_sha1, we free and re-initialize diffopts-pathspec-items. Since we did not make a deep copy of diffopts in diff_tree_combined, the original diffopts does not get the update. By the time we return from diff_tree_combined, rev-diffopt-pathspec-items points to an invalid memory address. We get a segfault next time we try to access that pathspec. I am not quite sure if I follow. Do you mean diff_tree_combined() - makes a shallow copy of rev-diffopt - calls diff_tree_sha1() diff_tree_sha1() - tries to follow rename and clobbers diffopt Right. - tries to use the shallow copy of original rev-diffopt that no longer is valid, which is a problem diff_tree_combined does not try to use it right away. It does return, but rev-diffopt is now invalid and the next time we do any kind of diff with it, we have a problem. I wonder, just like we force recursive and disable external on the copy before we use it to call diff_tree_sha1(), if we should disable follow-renames on it. --follow is an option that is given to the history traversal part and it should not play any role in getting the pairwise diff with all parents diff_tree_combined() does. Can't parse that last sentence. In any case, I don't think disabling diff_tree_sha1 is a solution. The bug is in diff_tree_sha1 and its subfunctions, because they manipulate a data structures such that it becomes corrupt. And they do so in an obfuscated and clearly unintentional manner. So we should not blame the user for calling diff_tree_sha1 in such a way that it causes corruption. Besides, - --follow hack lets us keep track of only one path; and Ok. Good to know it is considered a hack. The code is quite strange indeed. - -c and --cc make sense only when dealing with a merge commit and the path in the child may have come from different path in parents, Sorry, I don't get it. so I am not sure if allowing combination of --follow -c/--cc makes much sense in the first place. My use-case is came up with this history: 1. Code gets added to file A. 2. File A gets renamed to B in a different branch. 3. The branches get merged, and code from (1) is removed in the merge. Later I wonder why code from (1) is gone from B even though I felt certain it had been added before. I also remember that B was renamed at some point. So I do git log -p --follow B, and it nicely shows that diff where the code was added, but no diff where the code is removed. The reason is of course, that the code was removed in the merge and that diff is not shown. And -c is usually what I do to enable showing diffs in merge commits. And if the pairwise diff can also deal with file renames, I think it absolutely does make sense to show also a three-way diff. I can't tell far away the code is from supporting anything like that. Cheers, Clemens -- 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
Re: [PATCH] fix segfault with git log -c --follow
Clemens Buchacher dri...@aon.at writes: I wonder, just like we force recursive and disable external on the copy before we use it to call diff_tree_sha1(), if we should disable follow-renames on it. --follow is an option that is given to the history traversal part and it should not play any role in getting the pairwise diff with all parents diff_tree_combined() does. Can't parse that last sentence. In any case, I don't think disabling diff_tree_sha1 is a solution. The bug is in diff_tree_sha1 and its subfunctions, because they manipulate a data structures such that it becomes corrupt. And they do so in an obfuscated and clearly unintentional manner. So we should not blame the user for calling diff_tree_sha1 in such a way that it causes corruption. Besides, - --follow hack lets us keep track of only one path; and Ok. Good to know it is considered a hack. The code is quite strange indeed. The problem with --follow is that it only tracks one path globally. In a history like this, suppose that a path X long time ago was renamed to Y at commit B: ---o---A---B---C---o HEAD and you start digging with log --follow -c HEAD -- Y. When looking at C, because it and its parent B both have path Y, the try-to-follow hack does not kick in, and when trying to show C, we will show the change in Y (because that is the pathspec). Then we look at B. Because B has path we are following, i.e. Y, and its parent A does not, try-to-follow hack kicks in, and it mangles the pathspec that is used globally for history traversal to X while showing the difference between A's X and B's Y. Then we dig further to find A; at this point the global pathspec is swapped and now it is X. That makes --follow a working hack for a simplest single strand of pearls. But if you have a mergy history, e.g. ---o---A---B---C---o HEAD \ / D---E---F---G---H it can break in interesting ways. We are likely to have looked at H before looking at B and used pathspec Y while inspecting H, but after looking at B, the global pathspec is swapped to X, and then we try to look at G, F, E and D, none of which may have renamed the original X, so you would likely miss the change to the path Y you wanted to follow. To fix this, we would need to keep what path are we following not in the global revs-pathspec, but per the traversal paths that are currently active (e.g. when we look at C and H, it is Y, when we look at B, it is X, when we look at G, that is inherited from H and still Y, not affected by the rename at B. And then when we look at A (we need topo-order traversal to do this), it needs to notice that one child (i.e. B) has been following X while the other (i.e. D) Y, and merge the I've been following this path information in a sensible way (e.g. look at its own tree and see what is available, in this case X). -- 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
Re: [PATCH v2 7/8] remote-bzr: reorganize the way 'wanted' works
Junio C Hamano gits...@pobox.com wrote: Felipe Contreras felipe.contre...@gmail.com writes: +wanted = get_config('remote-bzr.branches').rstrip().split(', ') Two minor nits and one design suggestion: - Why rstrip() not strip()? The purpose of the strip is to remove the _single_ \n at the end that subprocess communicate. Maybe get_config() should do that. It appears that this only is helping an end-user mistake like this: git config remote-bzr.branches 'trunk, devel, test ' without helping people who have done this: git config remote-bzr.branches 'trunk, devel, test' No, that's tnot it. - Is git config remote-bzr.branches trunk,devel,test a grave sin? In other words, wouldn't we want something like this instead? map(lambda s: s.strip(), get_config('...').split(',')) Yeah, that might make sense. - Doesn't allowing multi-valued variable, e.g. [remote-bzr] branches = trunk branches = devel branches = test make it easier for the user to manage this configuration by e.g. selectively removing or adding tracked branches? How would the 'git config' command look like? Either way, that's orthogonal to this patch. -- Felipe Contreras -- 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
Re: [PATCH 1/2] sequencer: trivial fix
Junio C Hamano wrote: Neil Horman nhor...@tuxdriver.com writes: On Mon, May 27, 2013 at 11:52:18AM -0500, Felipe Contreras wrote: We should free objects before leaving. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sequencer.c b/sequencer.c index ab6f8a7..7eeae2f 100644 --- a/sequencer.c +++ b/sequencer.c @@ -626,12 +626,15 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) rerere(opts-allow_rerere_auto); } else { int allow = allow_empty(opts, commit); - if (allow 0) - return allow; + if (allow 0) { + res = allow; + goto leave; + } if (!opts-no_commit) res = run_git_commit(defmsg, opts, allow); } +leave: free_message(msg); free(defmsg); -- 1.8.3.rc3.312.g47657de Acked-by: Neil Horman nhor...@tuxdriver.com This is better done without goto in general. The other patch 2/2/ adds one more we need to exit from the middle of the flow and makes it look handier to add an exit label here, but it would be even better to express the logic of that patch as a normal cascade of if/else if/..., which is small enough and we do not need the leave: label. Linux kernel developers would disagree. In C 'goto' is quite of then the only sane option, and you can see 'goto' used in the Linux kernel all over the place for that reason. In this particular case it also makes perfect sense. It probably is better to fold this patch into the other one when it is rerolled to correct the option name gotcha on the tin. Why? This patch is standalone and fixes an issue that is independent of the other patch. Why squash two patches that do *two* different things? Anyway, I'll happily drop this patch if you want this memory leak to remain. But then I'll do the same in the other patch. This mantra of avodiing 'goto' is not helping anybody. -- Felipe Contreras -- 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
Re: [PATCH 4/5] test: improve rebase -q test
Junio C Hamano wrote: Felipe Contreras felipe.contre...@gmail.com writes: Let's show the output so it's clear why it failed. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- t/t3400-rebase.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index b58fa1a..fb39531 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -185,6 +185,7 @@ test_expect_success 'default to @{upstream} when upstream arg is missing' ' test_expect_success 'rebase -q is quiet' ' git checkout -b quiet topic git rebase -q master output.out 21 + cat output.out test ! -s output.out ' It is one thing to avoid squelching output that naturally comes out of command being tested unnecessarily, so that ./t-*.sh -v output can be used for debugging. I however am not sure if adding cat to random places like this is a productive direction for us to go in. A more preferrable alternative may be adding something like this to test-lib.sh and call it from here and elsewhere (there are about 50 places that do test ! -s filename), perhaps? test_must_be_an_empty_file () { if test -s $1 then cat $1 false fi } Perhaps, but I'm not interested. I'm tired of obvious fixes getting rejected for hypothetical ideal situations that we'll never reach. -- Felipe Contreras -- 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
Re: [PATCH 1/3] cherry-pick: add support to copy notes
Junio C Hamano wrote: Felipe Contreras felipe.contre...@gmail.com writes: Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- builtin/revert.c | 2 + sequencer.c | 136 -- sequencer.h | 2 + t/t3500-cherry.sh | 32 + 4 files changed, 169 insertions(+), 3 deletions(-) git cherry-pick should help maintaining notes just like amend and rebase, but how should this interact with notes.rewrite.command, where the command is capable of doing this without an explicit option once you tell which notes need to be maintained? Thomas Rast Cc'ed as he has been the primary force behind this line of notes usability. It probably is not sensible to carry over note from a reverted commit to its revert, but I didn't immediately spot how the patch does this only for cherry-pick but not for revert (the codepath in do_pick_commit() is shared between them, no?). The option is enabled from the UI, and only 'git cherry-pick' has the --copy-notes option. -- Felipe Contreras -- 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
Re: [PATCH 1/3] cherry-pick: add support to copy notes
Thomas Rast wrote: Junio C Hamano gits...@pobox.com writes: Thomas Rast Cc'ed as he has been the primary force behind this line of notes usability. Thanks for pointing this out to me. Felipe Contreras felipe.contre...@gmail.com writes: Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- builtin/revert.c | 2 + sequencer.c | 136 -- sequencer.h | 2 + t/t3500-cherry.sh | 32 + 4 files changed, 169 insertions(+), 3 deletions(-) git cherry-pick should help maintaining notes just like amend and rebase, but how should this interact with notes.rewrite.command, where the command is capable of doing this without an explicit option once you tell which notes need to be maintained? Since we already have the notes.rewrite.command convention, it would seem the obvious choice to line it up with the others. The main bikeshedding opportunity is whether this should be an exception and default to false (all other commands default it to true). Also: how does this interact with notes.rewriteRef and the corresponding env vars? Why? How does it interact with 'cherry-pick -n' if this is done in sequence, effectively squashing several commits (this use-case is actually suggested by the manpage), if multiple source commits had notes? Should it respect notes.rewriteMode (and by default concatenate)? (I don't know if the sequencer state is expressive enough already to carry this in a meaningful way across cherry-pick commands.) Feel free to implement that. I'm just interested in 'git cherry-pick' being usable for 'git rebase' purposes. -- Felipe Contreras -- 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
Re: [PATCH 2/4] remote-helpers: rename tests
Junio C Hamano wrote: Felipe Contreras felipe.contre...@gmail.com writes: The .t extension is more standard for sharness tests. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Is that sharness test the sh script testsuite forked from our testsuite? I do not see how it makes sense to copy how they deviate from us back to our codebase, especially if we plan to eventually move some of these tests out of contrib/ area, but even without such a plan in the future. They deviate from us, we deviate from them, whatever. We are a single project, what more than one project does is more standard. % man prove --ext Set the extension for tests (default '.t') -- Felipe Contreras -- 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
RE: contrib/git-normal-to-bare.sh
Zenaan Harkness wrote: This question comes up every now and then - how to convert from normal to bare, or vice versa. This is just a start to a basic script to go one way. Needs more tests etc, but it's enough to get newbies (like me) off to a reasonable start. PLEASE CC me, as I am not subscribed. You do not need to ask to be CC'ed. Any mailing list properly configued would not munge the Reply-To header, so anybody replying to this mail would reply to you. Git is a properly configured mailing list, just like all the mailing list in vger.kernel.org. Cheers. -- Felipe Contreras -- 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
RE: What's cooking in git.git (May 2013, #08; Tue, 28)
Junio C Hamano wrote: * fc/makefile (2013-05-26) 5 commits - build: do not install git-remote-testpy - build: add NO_INSTALL variable - build: cleanup using $ - build: cleanup using $^ - build: trivial simplification (this branch is used by fc/remote-helpers-use-specified-python.) No, these are independent. * fc/remote-helpers-use-specified-python (2013-05-28) 4 commits - remote-helpers: add exec-path links - remote-helpers: allow direct test execution - remote-helpers: rename tests - remote-helpers: generate scripts (this branch uses fc/makefile.) I do not particularly think the second from the bottom is a good change, but it takes the remainder of the series hostage. Will hopefully be rerolled without it. * fc/remote-bzr (2013-05-28) 8 commits - remote-bzr: add fallback check for a partial clone - remote-bzr: reorganize the way 'wanted' works - remote-bzr: trivial cleanups - remote-bzr: change global repo - remote-bzr: delay cloning/pulling - remote-bzr: simplify get_remote_branch() - remote-bzr: fix for files with spaces - remote-bzr: recover from failed clones The ones near the tip conflicted with the hotfix for 1.8.3 so I discarded them for now. Will merge to 'next'? Didn't I resend these with the conflict fixed? -- Felipe Contreras -- 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
Re: [PATCH 0/5] rebase: improve the keep-empty
Martin von Zweigbergk wrote: I think I have some patches at home that instead teach 'git am' the --keep-empty flag. Does that make sense? It's been a while since I looked at it, but I'll try to take a look tonight (PST). I think it does make sense. But I still would prefer 'git rebase' to rely on 'git cherry-pick' primariliy. -- Felipe Contreras -- 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
Re: [PATCH v2 0/3] Towards a useable git-branch
On Tue, May 28, 2013 at 9:28 PM, Ramkumar Ramachandra artag...@gmail.com wrote: Ramkumar Ramachandra wrote: %(N) doesn't work properly with f-e-r, and I'm not sure why. I'm not talking about your last patch where you compute * -- that works fine; it's just that %(N) doesn't when N is a concrete number. Try this: %(refname:short)%(30)%(upstream:short) (assuming that you have lots of branches). I'm noticing random alignment problems. It's because you don't pad enough spaces after %(refname:short) so the starting point of %(upstream:short) on each line is already unaligned, I think. Try this: %(*)%(refname:short)%(30)%(upstream:short) or if you prefer at specific column (e.g. align upstream close to the 60th column, regardless of refname's length): %(refname:short)%|(60)%(upstream:short) -- Duy -- 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
Re: [PATCH 2/5] rebase: fix 'cherry' mode storage
Junio C Hamano wrote: Felipe Contreras felipe.contre...@gmail.com writes: We don't use the 'rebase-apply'. s/.$/; we will use rebase-merge instead./ I think. We could use 'rebase-apply' or any directory, but currently we don't use any, and 'rebase-apply' is for 'git am'. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-rebase--cherry.sh | 4 git-rebase.sh | 5 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/git-rebase--cherry.sh b/git-rebase--cherry.sh index cbf80f9..ab1f8b7 100644 --- a/git-rebase--cherry.sh +++ b/git-rebase--cherry.sh @@ -18,6 +18,9 @@ esac test -n $rebase_root root_flag=--root +mkdir $state_dir || die Could not create temporary $state_dir +: $state_dir/cherry || die Could not mark as cherry Style: $state_dir/cherry-pick Fix that in git-rebase--interactive.sh then, where this code came from. I am not sure if the user _cares_ that internally we use cherry-pick when s/he asks us to do a keep-empty, and I suspect mark as cherry incomprehensible. I do not even know what is going on at this point (yet). It's the same we do in git-rebase--interactive.sh. I _suspect_ that you are using cherry-pick when --keep-empty is given, so it might even make sense to talk in the end-users' terms, i.e. call this $state_dir/keep-empty (I am not sure if calling this split half git-rebase--keep-empty.sh makes sense, yet). If git-rebase--cherry(-pick)?.sh does the same as 'git-rebase--am.sh', we can replace it, and make yet another step of replacing scripts (git am) with C code (git cherry-pick). I thought I explained that somewhow, maybe I didn't. It still makes sense to fix the broken --keep-empty behavior. -- Felipe Contreras -- 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] completion: avoid ls-remote in certain scenarios
It's _very_ slow in many cases, and there's really no point in fetching *everything* from the remote just for completion. In many cases it might be faster for the user to type the whole thing. If the user manually specifies 'refs/*', then the full ls-remote completion is triggered. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- contrib/completion/git-completion.bash | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1c35eef..2ce4f7d 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -427,14 +427,8 @@ __git_refs () done ;; *) - git ls-remote $dir HEAD ORIG_HEAD 'refs/tags/*' 'refs/heads/*' 'refs/remotes/*' 2/dev/null | \ - while read -r hash i; do - case $i in - *^{}) ;; - refs/*) echo ${i#refs/*/} ;; - *) echo $i ;; - esac - done + echo HEAD + git for-each-ref --format=%(refname:short) -- refs/remotes/$dir/ | sed -e s#^$dir/## ;; esac } -- 1.8.3.rc3.312.g47657de -- 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
Re: [PATCH v2 0/3] Towards a useable git-branch
On Tue, May 28, 2013 at 9:01 PM, Ramkumar Ramachandra artag...@gmail.com wrote: Also, a couple of minor annoyances: 1. When f-e-r is invoked with refs/tags, we get stray output. Atleast it doesn't segfault, thanks to your ignore-commit patch. Maybe printing stray output is the right thing to do, as opposed to erroring out. What format did you use? 2. %(*) only works with f-e-r atoms, not with pretty-format atoms. This is ofcourse obvious from the implementation, but isn't it a little consistent? It is not. I think it's documented as well as a known implementation limitation. It's not hard to be fixed (we could call format_commit_message again for all entries, this time with a single placeholder, to collect the best width). If anybody does need %(*)%H to work, we could do it. BTW, the way I implement get_atom_width() is not really optimal. For n lines, we call print_value() in get_atom_width n^2 times. We could cache the calculated width instead and reduce that to n times. Should we start off a new pretty-ref-formats document, where we explicitly exclude things like %ae (because of the hex overriding thing)? I don't think it's a problem if documented properly. And this one is doucmented as well, I think. I'd really like to introduce a new --pretty option (or something) that does not accept %xx as a hex notion, so %ae and friends won't be hidden. It's also a good thing for compatibility because currently %H in --format produces %H. After this, %H produces something else. It's unlikely that anybody has done that. But it's even better if we avoid that possibility entirely with a new option. -- Duy -- 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] completion: zsh: improve bash script loading
It's better to check in multiple locations, so the user doesn't have to. And update the documentation. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- contrib/completion/git-completion.zsh | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh index 2565d2e..9555cf8 100644 --- a/contrib/completion/git-completion.zsh +++ b/contrib/completion/git-completion.zsh @@ -4,18 +4,17 @@ # # Copyright (c) 2012-2013 Felipe Contreras felipe.contre...@gmail.com # -# You need git's bash completion script installed somewhere, by default on the -# same directory as this script. +# You need git's bash completion script installed somewhere, by default it +# would be the location bash-completion uses. # -# If your script is on ~/.git-completion.sh instead, you can configure it on -# your ~/.zshrc: +# If your script is somewhere else, you can configure it on your ~/.zshrc: # # zstyle ':completion:*:*:git:*' script ~/.git-completion.sh # -# The recommended way to install this script is to copy to -# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file: +# The recommended way to install this script is to copy to '~/.zsh/_git', and +# then add the following to your ~/.zshrc file: # -# fpath=(~/.zsh/completion $fpath) +# fpath=(~/.zsh $fpath) complete () { @@ -27,7 +26,18 @@ zstyle -T ':completion:*:*:git:*' tag-order \ zstyle ':completion:*:*:git:*' tag-order 'common-commands' zstyle -s :completion:*:*:git:* script script -test -z $script script=$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash +if [ -z $script ]; then + local -a locations + locations=( + '/etc/bash_completion.d/git' # fedora, old debian + '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian + '/usr/share/bash-completion/git' # gentoo + $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash + ) + for e in $locations; do + test -f $e script=$e break + done +fi ZSH_VERSION='' . $script __gitcomp () -- 1.8.3.rc3.312.g47657de -- 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
Re: 1.8.3 - gitignore not being parsed correctly on OS X; regex support is broken?
On Wed, May 29, 2013 at 12:54 AM, Misty De Meo mi...@brew.sh wrote: Hi, Gitignore parsing no longer seems to work properly in git 1.8.3. One of my repositories has the following gitignore: /* !/.gitignore !/Library/ !/CONTRIBUTING.md !/README.md !/SUPPORTERS.md !/bin /bin/* !/bin/brew !/share/man/man1/brew.1 .DS_Store /Library/LinkedKegs /Library/PinnedKegs /Library/Taps /Library/Formula/.gitignore In 1.8.2.3 and earlier, this works as expected. However, in 1.8.3 I'm seeing every file in /bin/ being marked as an untracked file. The changes in this area since 1.8.2.3 seem to be Karsten's (I'm not blaming, just wanted to narrow down the problem). The patterns of interest seem to be !/bin /bin/* !/bin/brew Without !/bin v1.8.3 seems to behave the same as v1.8.2.3. Can you verify it? I asked about this in #git, and was told that the culprit was the regex support; apparently recompiling without regex support fixes the specific gitignore issue. However, this doesn't seem to have been reported anywhere on the mailing list that I can see. I was also told that the issue is OS X-specific, and doesn't happen on other platforms. Puzzled. regex has nothing to do with gitignore (glob does). How do you recompile without regex support? Setting NO_REGEX? I'm on Linux btw, no chance of touching OS X. -- Duy -- 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 v2 0/8] cherry-pick: improvements
Hi, Here's a bunch of changes to make cherry-pick (and revert) more useful. In particular; this makes it more friendly for 'git rebase. Felipe Contreras (8): sequencer: remove useless indentation sequencer: trivial fix cherry-pick: add --skip-empty option cherry-pick: store rewritten commits sequencer: run post-rewrite hook cherry-pick: add support to copy notes revert/cherry-pick: add --quiet option revert/cherry-pick: add --skip option Documentation/git-cherry-pick.txt | 10 +- Documentation/git-revert.txt| 7 +- Documentation/sequencer.txt | 3 + builtin/revert.c| 11 ++ sequencer.c | 230 ++-- sequencer.h | 7 +- t/t3500-cherry.sh | 32 + t/t3508-cherry-pick-many-commits.sh | 13 ++ t/t3510-cherry-pick-sequence.sh | 12 ++ 9 files changed, 310 insertions(+), 15 deletions(-) -- 1.8.3.rc3.312.g47657de -- 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 v2 1/8] sequencer: remove useless indentation
By using good ol' goto. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sequencer.c b/sequencer.c index ab6f8a7..b4989ba 100644 --- a/sequencer.c +++ b/sequencer.c @@ -474,7 +474,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) struct commit_message msg = { NULL, NULL, NULL, NULL, NULL }; char *defmsg = NULL; struct strbuf msgbuf = STRBUF_INIT; - int res, unborn = 0; + int res, unborn = 0, allow; if (opts-no_commit) { /* @@ -624,14 +624,16 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) msg.subject); print_advice(res == 1, opts); rerere(opts-allow_rerere_auto); - } else { - int allow = allow_empty(opts, commit); - if (allow 0) - return allow; - if (!opts-no_commit) - res = run_git_commit(defmsg, opts, allow); + goto leave; } + allow = allow_empty(opts, commit); + if (allow 0) + return allow; + if (!opts-no_commit) + res = run_git_commit(defmsg, opts, allow); + +leave: free_message(msg); free(defmsg); -- 1.8.3.rc3.312.g47657de -- 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 v2 2/8] sequencer: trivial fix
We should free objects before leaving. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sequencer.c b/sequencer.c index b4989ba..f7be7d8 100644 --- a/sequencer.c +++ b/sequencer.c @@ -628,8 +628,10 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) } allow = allow_empty(opts, commit); - if (allow 0) - return allow; + if (allow 0) { + res = allow; + goto leave; + } if (!opts-no_commit) res = run_git_commit(defmsg, opts, allow); -- 1.8.3.rc3.312.g47657de -- 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 v2 3/8] cherry-pick: add --skip-empty option
Pretty much what it says on the tin. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-cherry-pick.txt | 3 +++ builtin/revert.c| 2 ++ sequencer.c | 6 ++ sequencer.h | 1 + t/t3508-cherry-pick-many-commits.sh | 13 + 5 files changed, 25 insertions(+) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index c205d23..fccd936 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -129,6 +129,9 @@ effect to your index in a row. redundant commits are ignored. This option overrides that behavior and creates an empty commit object. Implies `--allow-empty`. +--skip-empty:: + Instead of failing, skip commits that are or become empty. + --strategy=strategy:: Use the given merge strategy. Should only be used once. See the MERGE STRATEGIES section in linkgit:git-merge[1] diff --git a/builtin/revert.c b/builtin/revert.c index 0401fdb..0e5ce71 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -118,6 +118,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), OPT_END(), OPT_END(), + OPT_END(), }; if (opts-action == REPLAY_PICK) { @@ -127,6 +128,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_BOOLEAN(0, allow-empty, opts-allow_empty, N_(preserve initially empty commits)), OPT_BOOLEAN(0, allow-empty-message, opts-allow_empty_message, N_(allow commits with empty messages)), OPT_BOOLEAN(0, keep-redundant-commits, opts-keep_redundant_commits, N_(keep redundant, empty commits)), + OPT_BOOLEAN(0, skip-empty, opts-skip_empty, N_(skip empty commits)), OPT_END(), }; if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra)) diff --git a/sequencer.c b/sequencer.c index f7be7d8..d3c7d72 100644 --- a/sequencer.c +++ b/sequencer.c @@ -627,6 +627,12 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) goto leave; } + if (opts-skip_empty is_index_unchanged() == 1) { + warning(_(skipping %s... %s), + find_unique_abbrev(commit-object.sha1, DEFAULT_ABBREV), + msg.subject); + goto leave; + } allow = allow_empty(opts, commit); if (allow 0) { res = allow; diff --git a/sequencer.h b/sequencer.h index 1fc22dc..3b04844 100644 --- a/sequencer.h +++ b/sequencer.h @@ -34,6 +34,7 @@ struct replay_opts { int allow_empty; int allow_empty_message; int keep_redundant_commits; + int skip_empty; int mainline; diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh index 19c99d7..3dc19c6 100755 --- a/t/t3508-cherry-pick-many-commits.sh +++ b/t/t3508-cherry-pick-many-commits.sh @@ -187,4 +187,17 @@ test_expect_success 'cherry-pick --stdin works' ' check_head_differs_from fourth ' +test_expect_success 'cherry-pick skip empty' ' + git clean -fxd + git checkout -b empty fourth + git commit --allow-empty -m empty + test_commit ontop + git checkout -f master + git reset --hard fourth + git cherry-pick --skip-empty fourth..empty + echo ontop expected + git log --format=%s fourth..HEAD actual + test_cmp expected actual +' + test_done -- 1.8.3.rc3.312.g47657de -- 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 v2 4/8] cherry-pick: store rewritten commits
Will be useful for the next commits. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 95 - sequencer.h | 1 + 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index d3c7d72..c217716 100644 --- a/sequencer.c +++ b/sequencer.c @@ -20,6 +20,18 @@ const char sign_off_header[] = Signed-off-by: ; static const char cherry_picked_prefix[] = (cherry picked from commit ; +struct rewritten_list_item { + unsigned char from[20]; + unsigned char to[20]; +}; + +struct rewritten_list { + struct rewritten_list_item *items; + unsigned int nr, alloc; +}; + +static struct rewritten_list rewritten; + static int is_rfc2822_line(const char *buf, int len) { int i; @@ -102,6 +114,19 @@ static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob, return 1; } +static void add_rewritten(unsigned char *from, unsigned char *to) +{ + struct rewritten_list_item *item; + if (rewritten.nr + 1 = rewritten.alloc) { + rewritten.alloc += 32; + rewritten.items = xrealloc(rewritten.items, rewritten.alloc * sizeof(*rewritten.items)); + } + item = rewritten.items[rewritten.nr]; + hashcpy(item-from, from); + hashcpy(item-to, to); + rewritten.nr++; +} + static void remove_sequencer_state(void) { struct strbuf seq_dir = STRBUF_INIT; @@ -641,6 +666,14 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) if (!opts-no_commit) res = run_git_commit(defmsg, opts, allow); + if (!res) { + unsigned char to[20]; + + if (read_ref(HEAD, to)) + goto leave; + + add_rewritten(commit-object.sha1, to); + } leave: free_message(msg); free(defmsg); @@ -786,6 +819,40 @@ static void read_populate_todo(struct commit_list **todo_list, die(_(Unusable instruction sheet: %s), todo_file); } +static void read_populate_rewritten(void) +{ + const char *rewritten_file = git_path(SEQ_REWR_FILE); + struct strbuf buf = STRBUF_INIT; + char *p; + int fd; + + fd = open(rewritten_file, O_RDONLY); + if (fd 0) + return; + if (strbuf_read(buf, fd, 0) 0) { + close(fd); + strbuf_release(buf); + return; + } + close(fd); + + for (p = buf.buf; *p;) { + unsigned char from[20]; + unsigned char to[20]; + char *eol = strchrnul(p, '\n'); + if (eol - p != 81) + /* wrong size */ + break; + if (get_sha1_hex(p, from)) + break; + if (get_sha1_hex(p + 41, to)) + break; + add_rewritten(from, to); + p = *eol ? eol + 1 : eol; + } + strbuf_release(buf); +} + static int populate_opts_cb(const char *key, const char *value, void *data) { struct replay_opts *opts = data; @@ -958,6 +1025,29 @@ static void save_todo(struct commit_list *todo_list, struct replay_opts *opts) strbuf_release(buf); } +static void save_rewritten(void) +{ + const char *todo_file = git_path(SEQ_REWR_FILE); + static struct lock_file rewritten_lock; + struct strbuf buf = STRBUF_INIT; + int fd, i; + + fd = hold_lock_file_for_update(rewritten_lock, todo_file, LOCK_DIE_ON_ERROR); + for (i = 0; i rewritten.nr; i++) { + struct rewritten_list_item *item = rewritten.items[i]; + strbuf_addf(buf, %s %s\n, sha1_to_hex(item-from), sha1_to_hex(item-to)); + } + if (write_in_full(fd, buf.buf, buf.len) 0) { + strbuf_release(buf); + die_errno(_(Could not write to %s), todo_file); + } + if (commit_lock_file(rewritten_lock) 0) { + strbuf_release(buf); + die(_(Error wrapping up %s.), todo_file); + } + strbuf_release(buf); +} + static void save_opts(struct replay_opts *opts) { const char *opts_file = git_path(SEQ_OPTS_FILE); @@ -1003,8 +1093,10 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts) for (cur = todo_list; cur; cur = cur-next) { save_todo(cur, opts); res = do_pick_commit(cur-item, opts); - if (res) + if (res) { + save_rewritten(); return res; + } } /* @@ -1033,6 +1125,7 @@ static int sequencer_continue(struct replay_opts *opts) return continue_single_pick(); read_populate_opts(opts); read_populate_todo(todo_list, opts); + read_populate_rewritten(); /* Verify that the conflict has been
[PATCH v2 5/8] sequencer: run post-rewrite hook
As we should. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- sequencer.c | 45 - 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index c217716..3aa480e 100644 --- a/sequencer.c +++ b/sequencer.c @@ -127,6 +127,37 @@ static void add_rewritten(unsigned char *from, unsigned char *to) rewritten.nr++; } +static void run_rewrite_hook(void) +{ + struct strbuf buf = STRBUF_INIT; + struct child_process proc; + const char *argv[3]; + int code, i; + + argv[0] = find_hook(post-rewrite); + if (!argv[0]) + return; + + argv[1] = rebase; + argv[2] = NULL; + + memset(proc, 0, sizeof(proc)); + proc.argv = argv; + proc.in = -1; + proc.stdout_to_stderr = 1; + + code = start_command(proc); + if (code) + return; + for (i = 0; i rewritten.nr; i++) { + struct rewritten_list_item *item = rewritten.items[i]; + strbuf_addf(buf, %s %s\n, sha1_to_hex(item-from), sha1_to_hex(item-to)); + } + write_in_full(proc.in, buf.buf, buf.len); + close(proc.in); + finish_command(proc); +} + static void remove_sequencer_state(void) { struct strbuf seq_dir = STRBUF_INIT; @@ -1099,6 +1130,8 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts) } } + run_rewrite_hook(); + /* * Sequence of picks finished successfully; cleanup by * removing the .git/sequencer directory @@ -1136,14 +1169,24 @@ static int sequencer_continue(struct replay_opts *opts) } if (index_differs_from(HEAD, 0)) return error_dirty_index(opts); + { + unsigned char to[20]; + if (!read_ref(HEAD, to)) + add_rewritten(todo_list-item-object.sha1, to); + } todo_list = todo_list-next; return pick_commits(todo_list, opts); } static int single_pick(struct commit *cmit, struct replay_opts *opts) { + int ret; setenv(GIT_REFLOG_ACTION, action_name(opts), 0); - return do_pick_commit(cmit, opts); + ret = do_pick_commit(cmit, opts); + if (ret) + return ret; + run_rewrite_hook(); + return 0; } int sequencer_pick_revisions(struct replay_opts *opts) -- 1.8.3.rc3.312.g47657de -- 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 v2 6/8] cherry-pick: add support to copy notes
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- builtin/revert.c | 2 ++ sequencer.c | 33 - sequencer.h | 1 + t/t3500-cherry.sh | 32 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/builtin/revert.c b/builtin/revert.c index 0e5ce71..b977124 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -119,6 +119,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), OPT_END(), OPT_END(), + OPT_END(), }; if (opts-action == REPLAY_PICK) { @@ -129,6 +130,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_BOOLEAN(0, allow-empty-message, opts-allow_empty_message, N_(allow commits with empty messages)), OPT_BOOLEAN(0, keep-redundant-commits, opts-keep_redundant_commits, N_(keep redundant, empty commits)), OPT_BOOLEAN(0, skip-empty, opts-skip_empty, N_(skip empty commits)), + OPT_BOOLEAN(0, copy-notes, opts-copy_notes, N_(copy notes)), OPT_END(), }; if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra)) diff --git a/sequencer.c b/sequencer.c index 3aa480e..cc9c2bc 100644 --- a/sequencer.c +++ b/sequencer.c @@ -127,6 +127,27 @@ static void add_rewritten(unsigned char *from, unsigned char *to) rewritten.nr++; } +static void copy_notes(void) +{ + unsigned char note_commit[20]; + struct strbuf buf = STRBUF_INIT; + struct notes_tree *t = default_notes_tree; + int i; + + init_notes(t, NULL, NULL, 0); + + for (i = 0; i rewritten.nr; i++) { + struct rewritten_list_item *item = rewritten.items[i]; + copy_note(t, item-from, item-to, 0, NULL); + } + + strbuf_addstr(buf, Notes added by 'git cherry-pick'\n); + create_notes_commit(default_notes_tree, NULL, buf, note_commit); + strbuf_insert(buf, 0, notes: , 7); + update_ref(buf.buf, t-ref, note_commit, NULL, 0, MSG_ON_ERR); + strbuf_release(buf); +} + static void run_rewrite_hook(void) { struct strbuf buf = STRBUF_INIT; @@ -908,7 +929,10 @@ static int populate_opts_cb(const char *key, const char *value, void *data) else if (!strcmp(key, options.strategy-option)) { ALLOC_GROW(opts-xopts, opts-xopts_nr + 1, opts-xopts_alloc); opts-xopts[opts-xopts_nr++] = xstrdup(value); - } else + } + else if (!strcmp(key, options.copy-notes)) + opts-copy_notes = git_config_bool_or_int(key, value, error_flag); + else return error(_(Invalid key: %s), key); if (!error_flag) @@ -1108,6 +1132,8 @@ static void save_opts(struct replay_opts *opts) options.strategy-option, opts-xopts[i], ^$, 0); } + if (opts-copy_notes) + git_config_set_in_file(opts_file, options.copy-notes, true); } static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts) @@ -1132,6 +1158,9 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts) run_rewrite_hook(); + if (opts-copy_notes) + copy_notes(); + /* * Sequence of picks finished successfully; cleanup by * removing the .git/sequencer directory @@ -1186,6 +1215,8 @@ static int single_pick(struct commit *cmit, struct replay_opts *opts) if (ret) return ret; run_rewrite_hook(); + if (opts-copy_notes) + copy_notes(); return 0; } diff --git a/sequencer.h b/sequencer.h index 84b9957..6cc072c 100644 --- a/sequencer.h +++ b/sequencer.h @@ -36,6 +36,7 @@ struct replay_opts { int allow_empty_message; int keep_redundant_commits; int skip_empty; + int copy_notes; int mainline; diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh index f038f34..79c1219 100755 --- a/t/t3500-cherry.sh +++ b/t/t3500-cherry.sh @@ -55,4 +55,36 @@ test_expect_success \ expr $(echo $(git cherry master my-topic-branch) ) : + [^ ]* - .* ' +test_expect_success \ +'copy notes' \ +'git checkout master +echo notes C +test_tick +git commit -a -m Update C +git notes add -m a note +git checkout -b note-test HEAD^ +git cherry-pick --copy-notes -x master +test a note = $(git notes show HEAD) +' + +test_expect_success \ +'copy multiple notes' \ +'git checkout master +echo multiple notes C +git commit -a -m Update C again +git notes add -m another note +git commit -a -m Empty --allow-empty +echo more notes C +git commit -a -m Update
[PATCH v2 7/8] revert/cherry-pick: add --quiet option
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-cherry-pick.txt | 6 +- Documentation/git-revert.txt | 6 +- builtin/revert.c | 1 + sequencer.c | 9 ++--- sequencer.h | 1 + 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index fccd936..da0bd81 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -8,7 +8,7 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... +'git cherry-pick' [-q] [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort @@ -51,6 +51,10 @@ OPTIONS feed all commit... arguments to a single revision walk (see a later example that uses 'maint master..next'). +-q:: +--quiet:: + Quiet, suppress feedback messages. + -e:: --edit:: With this option, 'git cherry-pick' will let you edit the commit diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index f79c9d8..98a8e7a 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] commit... +'git revert' [-q] [--[no-]edit] [-n] [-m parent-number] [-s] commit... 'git revert' --continue 'git revert' --quit 'git revert' --abort @@ -40,6 +40,10 @@ OPTIONS default, see linkgit:git-rev-list[1] and its '--no-walk' option. +-q:: +--quiet:: + Quiet, suppress feedback messages. + -e:: --edit:: With this option, 'git revert' will let you edit the commit diff --git a/builtin/revert.c b/builtin/revert.c index b977124..d63b4a6 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -100,6 +100,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) int contin = 0; int rollback = 0; struct option options[] = { + OPT__QUIET(opts-quiet, N_(suppress progress reporting)), OPT_BOOLEAN(0, quit, remove_state, N_(end revert or cherry-pick sequence)), OPT_BOOLEAN(0, continue, contin, N_(resume revert or cherry-pick sequence)), OPT_BOOLEAN(0, abort, rollback, N_(cancel revert or cherry-pick sequence)), diff --git a/sequencer.c b/sequencer.c index cc9c2bc..b7391d6 100644 --- a/sequencer.c +++ b/sequencer.c @@ -466,6 +466,8 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, argv_array_init(array); argv_array_push(array, commit); argv_array_push(array, -n); + if (opts-quiet) + argv_array_push(array, -q); if (opts-signoff) argv_array_push(array, -s); @@ -705,9 +707,10 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) } if (opts-skip_empty is_index_unchanged() == 1) { - warning(_(skipping %s... %s), - find_unique_abbrev(commit-object.sha1, DEFAULT_ABBREV), - msg.subject); + if (!opts-quiet) + warning(_(skipping %s... %s), + find_unique_abbrev(commit-object.sha1, DEFAULT_ABBREV), + msg.subject); goto leave; } allow = allow_empty(opts, commit); diff --git a/sequencer.h b/sequencer.h index 6cc072c..41e19d0 100644 --- a/sequencer.h +++ b/sequencer.h @@ -37,6 +37,7 @@ struct replay_opts { int keep_redundant_commits; int skip_empty; int copy_notes; + int quiet; int mainline; -- 1.8.3.rc3.312.g47657de -- 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 v2 8/8] revert/cherry-pick: add --skip option
Akin to 'am --skip' and 'rebase --skip'. Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- Documentation/git-cherry-pick.txt | 1 + Documentation/git-revert.txt | 1 + Documentation/sequencer.txt | 3 +++ builtin/revert.c | 6 ++ sequencer.c | 32 +--- sequencer.h | 3 ++- t/t3510-cherry-pick-sequence.sh | 12 7 files changed, 54 insertions(+), 4 deletions(-) diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index da0bd81..d95c63c 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -10,6 +10,7 @@ SYNOPSIS [verse] 'git cherry-pick' [-q] [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] commit... 'git cherry-pick' --continue +'git cherry-pick' --skip 'git cherry-pick' --quit 'git cherry-pick' --abort diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt index 98a8e7a..52e146e 100644 --- a/Documentation/git-revert.txt +++ b/Documentation/git-revert.txt @@ -10,6 +10,7 @@ SYNOPSIS [verse] 'git revert' [-q] [--[no-]edit] [-n] [-m parent-number] [-s] commit... 'git revert' --continue +'git revert' --skip 'git revert' --quit 'git revert' --abort diff --git a/Documentation/sequencer.txt b/Documentation/sequencer.txt index 5747f44..df2d355 100644 --- a/Documentation/sequencer.txt +++ b/Documentation/sequencer.txt @@ -3,6 +3,9 @@ '.git/sequencer'. Can be used to continue after resolving conflicts in a failed cherry-pick or revert. +--skip:: + Skip the current commit, and then continue. + --quit:: Forget about the current operation in progress. Can be used to clear the sequencer state after a failed cherry-pick or diff --git a/builtin/revert.c b/builtin/revert.c index d63b4a6..6afd990 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -99,11 +99,13 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) int remove_state = 0; int contin = 0; int rollback = 0; + int skip = 0; struct option options[] = { OPT__QUIET(opts-quiet, N_(suppress progress reporting)), OPT_BOOLEAN(0, quit, remove_state, N_(end revert or cherry-pick sequence)), OPT_BOOLEAN(0, continue, contin, N_(resume revert or cherry-pick sequence)), OPT_BOOLEAN(0, abort, rollback, N_(cancel revert or cherry-pick sequence)), + OPT_BOOLEAN(0, skip, skip, N_(skip current commit in the sequence)), OPT_BOOLEAN('n', no-commit, opts-no_commit, N_(don't automatically commit)), OPT_BOOLEAN('e', edit, opts-edit, N_(edit the commit message)), OPT_NOOP_NOARG('r', NULL), @@ -160,6 +162,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) opts-subcommand = REPLAY_CONTINUE; else if (rollback) opts-subcommand = REPLAY_ROLLBACK; + else if (skip) + opts-subcommand = REPLAY_SKIP; else opts-subcommand = REPLAY_NONE; @@ -170,6 +174,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) this_operation = --quit; else if (opts-subcommand == REPLAY_CONTINUE) this_operation = --continue; + else if (opts-subcommand == REPLAY_SKIP) + this_operation = --skip; else { assert(opts-subcommand == REPLAY_ROLLBACK); this_operation = --abort; diff --git a/sequencer.c b/sequencer.c index b7391d6..46bbe29 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1182,7 +1182,9 @@ static int continue_single_pick(void) return run_command_v_opt(argv, RUN_GIT_CMD); } -static int sequencer_continue(struct replay_opts *opts) +static void add_rewritten(unsigned char *from, unsigned char *to); + +static int sequencer_continue(struct replay_opts *opts, int skip) { struct commit_list *todo_list = NULL; @@ -1201,7 +1203,7 @@ static int sequencer_continue(struct replay_opts *opts) } if (index_differs_from(HEAD, 0)) return error_dirty_index(opts); - { + if (!skip) { unsigned char to[20]; if (!read_ref(HEAD, to)) add_rewritten(todo_list-item-object.sha1, to); @@ -1210,6 +1212,28 @@ static int sequencer_continue(struct replay_opts *opts) return pick_commits(todo_list, opts); } +static int sequencer_skip(struct replay_opts *opts) +{ + const char *argv[4]; /* reset --hard HEAD + NULL */ + struct string_list merge_rr = STRING_LIST_INIT_DUP; + int ret; + + if (setup_rerere(merge_rr, 0) = 0) { + rerere_clear(merge_rr); + string_list_clear(merge_rr, 1); + }