Re: tools for easily "uncommitting" parts of a patch I just commited?

2016-10-22 Thread Jeff King
On Sun, Oct 23, 2016 at 08:23:01AM +0700, Duy Nguyen wrote: > I hit the same problem sometimes, but in my case sometimes I > accidentally do "git add" after "git add -p" and a configuration in > "git commit -a" won't help me. I'd prefer we could undo changes in > index instead. Something like refl

Re: tools for easily "uncommitting" parts of a patch I just commited?

2016-10-22 Thread Duy Nguyen
On Sat, Oct 22, 2016 at 4:19 PM, Lukas Fleischer wrote: > On Thu, 20 Oct 2016 at 19:27:58, Jacob Keller wrote: >> [...] >> I still think we're misunderstanding. I want git commit to complain >> *only* under the following circumstance: >> >> I run "git add -p" and put a partial change into the inde

Re: tools for easily "uncommitting" parts of a patch I just commited?

2016-10-22 Thread Jacob Keller
On Sat, Oct 22, 2016 at 2:19 AM, Lukas Fleischer wrote: > On Thu, 20 Oct 2016 at 19:27:58, Jacob Keller wrote: >> [...] >> I still think we're misunderstanding. I want git commit to complain >> *only* under the following circumstance: >> >> I run "git add -p" and put a partial change into the inde

[PATCH 24/36] attr.c: always pass check[] to collect_some_attrs()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano This function used to be called with check=NULL to signal it to collect all attributes in the global check_all_attr[] array. Because the longer term plan is to allocate check_all_attr[] and attr_stack data structures per git_attr_check instance (i.e. "check" here) to make th

[PATCH 36/36] completion: clone can initialize specific submodules

2016-10-22 Thread Stefan Beller
Signed-off-by: Stefan Beller --- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 21016bf..90eb772 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/com

[PATCH 33/36] pathspec: allow escaped query values

2016-10-22 Thread Stefan Beller
In our own .gitattributes file we have attributes such as: *.[ch] whitespace=indent,trail,space When querying for attributes we want to be able to ask for the exact value, i.e. git ls-files :(attr:whitespace=indent,trail,space) should work, but the commas are used in the attr magic to i

[PATCH 34/36] submodule update: add `--init-default-path` switch

2016-10-22 Thread Stefan Beller
The new switch `--init-default-path` initializes the submodules which are configured in `submodule.defaultUpdatePath` instead of those given as command line arguments before updating. In the first implementation this is made incompatible with further command line arguments as it is unclear what the

[PATCH 32/36] pathspec: allow querying for attributes

2016-10-22 Thread Stefan Beller
The pathspec mechanism is extended via the new ":(attr:eol=input)pattern/to/match" syntax to filter paths so that it requires paths to not just match the given pattern but also have the specified attrs attached for them to be chosen. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano ---

[PATCH 35/36] clone: add --init-submodule= switch

2016-10-22 Thread Stefan Beller
The new switch passes the pathspec to `git submodule update --init` which is called after the actual clone is done. Additionally this configures the submodule.defaultUpdatePath to be the given pathspec, such that any future invocation of `git submodule update --init-default-paths` will keep up wit

[PATCH 13/36] attr: convert git_check_attrs() callers to use the new API

2016-10-22 Thread Stefan Beller
From: Junio C Hamano The remaining callers are all simple "I have N attributes I am interested in. I'll ask about them with various paths one by one". After this step, no caller to git_check_attrs() remains. After removing it, we can extend "struct git_attr_check" struct with data that can be

[PATCH 25/36] attr.c: outline the future plans by heavily commenting

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- attr.c | 40 +++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/attr.c b/attr.c index 673dc7a..0f08ee6 100644 --- a/attr.c +++ b/attr.c @@ -30,6 +30,11 @@ sta

[PATCH 14/36] attr: retire git_check_attrs() API

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Since nobody uses the old API, make it file-scope static, and update the documentation to describe the new API. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- Documentation/technical/api-gitattributes.txt | 82 ++- attr.c

[PATCH 03/36] attr.c: update a stale comment on "struct match_attr"

2016-10-22 Thread Stefan Beller
From: Junio C Hamano When 82dce998 (attr: more matching optimizations from .gitignore, 2012-10-15) changed a pointer to a string "*pattern" into an embedded "struct pattern" in struct match_attr, it forgot to update the comment that describes the structure. Signed-off-by: Junio C Hamano Signed-

[PATCH 20/36] attr.c: pass struct git_attr_check down the callchain

2016-10-22 Thread Stefan Beller
From: Junio C Hamano The callchain that starts from git_check_attrs() down to collect_some_attrs() used to take an array of git_attr_check_elem as their parameters. Pass the enclosing git_attr_check instance instead, so that they will have access to new fields we will add to the data structure.

[PATCH 06/36] attr.c: mark where #if DEBUG ends more clearly

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attr.c b/attr.c index a7f2c3f..95416d3 100644 --- a/attr.c +++ b/attr.c @@ -469,7 +469,7 @@ static void debug_set(const char *what, con

[PATCH 23/36] attr.c: introduce empty_attr_check_elems()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano One codepath needs to just empty the git_attr_check_elem array in the git_attr_check structure, without releasing the entire resource. Introduce a helper to do so and rewrite git_attr_check_clear() using it. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- a

[PATCH 22/36] attr.c: correct ugly hack for git_all_attrs()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano The collect_some_attrs() function has an ugly hack since 06a604e6 (attr: avoid heavy work when we know the specified attr is not defined, 2014-12-28) added an optimization that relies on the fact that the caller knows what attributes it is interested in, so that we can leave

[PATCH 09/36] attr.c: plug small leak in parse_attr_line()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano If any error is noticed after the match_attr structure is allocated, we shouldn't just return NULL from this function. Add a fail_return label that frees the allocated structure and returns NULL, and consistently jump there when we want to return NULL after cleaning up. Sig

[PATCH 04/36] attr.c: explain the lack of attr-name syntax check in parse_attr()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- attr.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/attr.c b/attr.c index 4ae7801..05db667 100644 --- a/attr.c +++ b/attr.c @@ -183,6 +183,12 @@ static const char *parse_attr(const char *src, int l

[PATCH 31/36] pathspec: move prefix check out of the inner loop

2016-10-22 Thread Stefan Beller
The prefix check is not related the check of pathspec magic; also there is no code that is relevant after we'd break the loop on a match for "prefix:". So move the check before the loop and shortcircuit the outer loop. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- pathspec.c |

[PATCH 08/36] attr.c: tighten constness around "git_attr" structure

2016-10-22 Thread Stefan Beller
From: Junio C Hamano It holds an interned string, and git_attr_name() is a way to peek into it. Make sure the involved pointer types are pointer-to-const. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- attr.c | 2 +- attr.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deleti

[PATCH 29/36] Documentation: fix a typo

2016-10-22 Thread Stefan Beller
Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 8a061af..5b31797 100644 --- a/Documentation/gitattributes.txt

[PATCH 11/36] attr: (re)introduce git_check_attr() and struct git_attr_check

2016-10-22 Thread Stefan Beller
From: Junio C Hamano A common pattern to check N attributes for many paths is to (1) prepare an array A of N git_attr_check_elem items; (2) call git_attr() to intern the N attribute names and fill A; (3) repeatedly call git_check_attrs() for path with N and A; A look-up for these N attribute

[PATCH 07/36] attr.c: simplify macroexpand_one()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano The double-loop wants to do an early return immediately when one matching macro is found. Eliminate the extra variable 'a' used for that purpose and rewrite the "assign the found item to 'a' to make it non-NULL and force the loop(s) to terminate" with a direct return from th

[PATCH 10/36] attr: rename function and struct related to checking attributes

2016-10-22 Thread Stefan Beller
From: Junio C Hamano The traditional API to check attributes is to prepare an N-element array of "struct git_attr_check" and pass N and the array to the function "git_check_attr()" as arguments. In preparation to revamp the API to pass a single structure, in which these N elements are held, rena

[PATCH 18/36] attr: support quoting pathname patterns in C style

2016-10-22 Thread Stefan Beller
From: Nguyễn Thái Ngọc Duy Full pattern must be quoted. So 'pat"t"ern attr' will give exactly 'pat"t"ern', not 'pattern'. Also clarify that leading whitespaces are not part of the pattern and document comment syntax. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano Signed-off-

[PATCH 26/36] attr: make git_check_attr_counted static

2016-10-22 Thread Stefan Beller
It's not used outside the attr code, so let's keep it private. Signed-off-by: Stefan Beller --- attr.c | 4 ++-- attr.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/attr.c b/attr.c index 0f08ee6..881bdfa 100644 --- a/attr.c +++ b/attr.c @@ -892,8 +892,8 @@ void git_attr_

[PATCH 17/36] attr: expose validity check for attribute names

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Export attr_name_valid() function, and a helper function that returns the message to be given when a given pair is not a good name for an attribute. We could later update the message to exactly spell out what the rules for a good attribute name are, etc. Signed-off-by: Jun

[PATCH 15/36] attr: add counted string version of git_check_attr()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Often a potential caller has pair that represents the path it wants to ask attributes for; when path[pathlen] is not NUL, the caller has to xmemdupz() only to call git_check_attr(). Add git_check_attr_counted() that takes such a counted string instead of "const char *path".

[PATCH 05/36] attr.c: complete a sentence in a comment

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attr.c b/attr.c index 05db667..a7f2c3f 100644 --- a/attr.c +++ b/attr.c @@ -300,7 +300,7 @@ static struct match_attr *parse_attr_line(c

[PATCH 16/36] attr: add counted string version of git_attr()

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Often a potential caller has pair that represents the name it wants to create an attribute out of. When name[namelen] is not NUL, the caller has to xmemdupz() only to call git_attr(). Add git_attr_counted() that takes such a counted string instead of "const char *name". S

[PATCH 19/36] attr.c: add push_stack() helper

2016-10-22 Thread Stefan Beller
From: Junio C Hamano There are too many repetitious "I have this new attr_stack element; push it at the top of the stack" sequence. The new helper function push_stack() gives us a way to express what is going on at these places, and as a side effect, halves the number of times we mention the att

[PATCH 28/36] attr: keep attr stack for each check

2016-10-22 Thread Stefan Beller
Instead of having a global attr stack, attach the stack to each check. This allows to use the attr in a multithreaded way. Signed-off-by: Stefan Beller --- attr.c| 101 +++--- attr.h| 4 ++- hashmap.h | 2 ++ 3 files changed,

[PATCH 21/36] attr.c: rename a local variable check

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Throughout this series, we are trying to use "check" to name an instance of "git_attr_check" structure; let's rename a "check" that refers to an array whose elements are git_attr_check_elem to avoid confusion. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller ---

[PATCH 30/36] pathspec: move long magic parsing out of prefix_pathspec

2016-10-22 Thread Stefan Beller
`prefix_pathspec` is quite a lengthy function and we plan on adding more. Split it up for better readability. As we want to add code into the inner loop of the long magic parsing, we also benefit from lower indentation. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- pathspec.c |

[PATCH 27/36] attr: convert to new threadsafe API

2016-10-22 Thread Stefan Beller
This revamps the API of the attr subsystem to be thread safe. Before we had the question and its results in one struct type. The typical usage of the API was static struct git_attr_check *check; if (!check) check = git_attr_check_initl("text", NULL); git_check_attr(path, chec

[PATCH 12/36] attr: convert git_all_attrs() to use "struct git_attr_check"

2016-10-22 Thread Stefan Beller
From: Junio C Hamano This updates the other two ways the attribute check is done via an array of "struct git_attr_check_elem" elements. These two niches appear only in "git check-attr". * The caller does not know offhand what attributes it wants to ask about and cannot use git_attr_check_in

[PATCH 02/36] attr.c: use strchrnul() to scan for one line

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- attr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attr.c b/attr.c index eec5d7d..45aec1b 100644 --- a/attr.c +++ b/attr.c @@ -402,8 +402,8 @@ static struct attr_stack *read_attr_fro

[PATCHv2 00/36] Revamping the attr subsystem!

2016-10-22 Thread Stefan Beller
previous discussion: http://public-inbox.org/git/20161012224109.23410-1-sbel...@google.com http://public-inbox.org/git/20161011002115.23312-1-sbel...@google.com/ This implements the discarded series': jc/attr jc/attr-more sb/pathspec-label sb/submodule-default-paths * I rebase to origin master (n

[PATCH 01/36] commit.c: use strchrnul() to scan for one line

2016-10-22 Thread Stefan Beller
From: Junio C Hamano Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- commit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/commit.c b/commit.c index 856fd4a..41b2fdd 100644 --- a/commit.c +++ b/commit.c @@ -415,8 +415,7 @@ int find_commit_subject(const c

Stash pop/apply conflict and --theirs and --ours

2016-10-22 Thread Sven Strickroth
Hi, I regularly experience that beginners have problems unterstanding that --ours and --theirs are swapped when a conflict occurrs on git stash apply or stash pop. >From the HCI perspective this is really counter intuitive. So, I'd like to propose that on git shash pop/apply theirs and ours shou

Re: [PATCH 2/3] submodule tests: replace cloning from . by "$(pwd)"

2016-10-22 Thread Stefan Beller
On Sat, Oct 22, 2016 at 12:33 AM, Junio C Hamano wrote: > Johannes Sixt writes: > >>> The logic to construct the relative urls is not smart enough to >>> detect that the ending /. is referring to the directory itself >>> but rather treats it like any other relative path, i.e. >>> >>> path/to/

Re: [PATCH v5 00/27] Prepare the sequencer for the upcoming rebase -i patches

2016-10-22 Thread Junio C Hamano
Johannes Schindelin writes: > This patch series marks the '4' in the countdown to speed up rebase -i > by implementing large parts in C (read: there will be three more patch > series after that before the full benefit hits git.git: sequencer-i, > rebase--helper and rebase-i-extra). > ... > It wou

Re: [PATCH] daemon: detect and reject too-long paths

2016-10-22 Thread Junio C Hamano
Jeff King writes: > When we are checking the path via path_ok(), we use some > fixed PATH_MAX buffers. We write into them via snprintf(), > so there's no possibility of overflow, but it does mean we > may silently truncate the path, leading to potentially > confusing errors when the partial path

Re: [PATCH 3/3] transport: allow summary-width to be computed dynamically

2016-10-22 Thread Junio C Hamano
Jeff King writes: > On Fri, Oct 21, 2016 at 09:39:45PM -0700, Junio C Hamano wrote: > >> And this is the final one. >> >> -- >8 -- >> From: Junio C Hamano >> Date: Fri, 21 Oct 2016 21:33:06 -0700 >> Subject: [PATCH] transport: compute summary-width dynamically >> >> Now all that is left to do

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-22 Thread Junio C Hamano
Christian Couder writes: > On Fri, Oct 21, 2016 at 2:18 AM, Junio C Hamano wrote: >> >> If I were guiding a topic that introduce this feature from scratch >> today, I would probably suggest a pattern based approach, e.g. a >> built-in "[-A-Za-z0-9]+:" [*1*] may be the default prefix that is >>

Contact Mr.Alex Morgan For Your payment (2.1M USD

2016-10-22 Thread George Fred
Attention, Be informed that We have concluded to effect your payment (2.1M USD) Two Million One Hundred Thousand Dollars through Western Union Money Transfer. But the maximum amount you will be receiving daily starting from tomorrow onward is 5,100.00USD until the funds is completely paid out t

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-22 Thread Christian Couder
On Fri, Oct 21, 2016 at 2:18 AM, Junio C Hamano wrote: > Jonathan Tan writes: > >> That is true - I think we can take the allowed separators as an >> argument (meaning that we can have different behavior for file parsing >> and command line parsing), and since we already have that string, we >> c

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-22 Thread Christian Couder
On Fri, Oct 21, 2016 at 12:45 AM, Junio C Hamano wrote: > Jonathan Tan writes: > >> If we do that, there is also the necessity of creating a string that >> combines the separators and '=' (I guess '\n' is not necessary now, >> since all the lines are null terminated). I'm OK either way. >> >> (We

Re: tools for easily "uncommitting" parts of a patch I just commited?

2016-10-22 Thread Lukas Fleischer
On Thu, 20 Oct 2016 at 19:27:58, Jacob Keller wrote: > [...] > I still think we're misunderstanding. I want git commit to complain > *only* under the following circumstance: > > I run "git add -p" and put a partial change into the index in . > There are still other parts which were not added to th

Re: [PATCH 2/3] submodule tests: replace cloning from . by "$(pwd)"

2016-10-22 Thread Junio C Hamano
Johannes Sixt writes: >> The logic to construct the relative urls is not smart enough to >> detect that the ending /. is referring to the directory itself >> but rather treats it like any other relative path, i.e. >> >> path/to/dir/. + ../relative/path/to/submodule >> >> would result in >> >>

Re: [PATCH 2/3] submodule tests: replace cloning from . by "$(pwd)"

2016-10-22 Thread Johannes Sixt
Am 22.10.2016 um 01:59 schrieb Stefan Beller: When adding a submodule via "git submodule add ", the relative url applies to the superprojects remote. When the superproject was cloned via "git clone . super", the remote url is ending with '/.'. The logic to construct the relative urls is not smar