* Re: feature request: allow to stash changed files
From: Thomas Gummerer @ 2017-01-15 14:26 UTC (permalink / raw)
To: KES; +Cc: git
In-Reply-To: <2141311484484121@web16g.yandex.ru>
On 01/15, KES wrote:
> http://stackoverflow.com/questions/3040833/stash-only-one-file-out-of-multiple-files-that-have-changed-with-git#comment32451416_3040833
>
> Sometimes poople are forced to save stash for changed files. But there is no such option (
You may just be lucky. I've been wishing for something like that for
a while now as well, and finally got around to write a patch this
weekend.
^ permalink raw reply
* Re: [PATCH] Documentation/bisect: improve on (bad|new) and (good|bad)
From: Christian Couder @ 2017-01-15 14:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Manuel Ullmann, Matthieu Moy, Christian Couder
In-Reply-To: <xmqqinpihiwz.fsf@gitster.mtv.corp.google.com>
On Fri, Jan 13, 2017 at 8:14 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Christian Couder <christian.couder@gmail.com> writes:
>
>> The following part of the description:
>>
>> git bisect (bad|new) [<rev>]
>> git bisect (good|old) [<rev>...]
>>
>> may be a bit confusing, as a reader may wonder if instead it should be:
>>
>> git bisect (bad|good) [<rev>]
>> git bisect (old|new) [<rev>...]
>>
>> Of course the difference between "[<rev>]" and "[<rev>...]" should hint
>> that there is a good reason for the way it is.
>>
>> But we can further clarify and complete the description by adding
>> "<term-new>" and "<term-old>" to the "bad|new" and "good|old"
>> alternatives.
>>
>> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
>> ---
>> Documentation/git-bisect.txt | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Thanks. The patch looks good.
>
> A related tangent.
>
> Last night, I was trying to think if there is a fundamental reason
> why "bad/new/term-new" cannot take more than one <rev>s on the newer
> side of the bisection, and couldn't quite think of any before
> falling asleep.
>
> Currently we keep track of a single bisect/bad, while marking all the
> revs given as good previously as bisect/good-<SHA-1>.
>
> Because the next "bad" is typically chosen from the region of the
> commit DAG that is bounded by bad and good commits, i.e. "rev-list
> bisect/bad --not bisect/good-*", the current bisect/bad will always
> be an ancestor of all bad commits that used to be bisect/bad, and
> keeping previous bisect/bad as bisect/bad-<SHA-1> won't change the
> region of the commit DAG yet to be explored.
>
> As a reason why we need to use only a single bisect/bad, the above
> description is understandable. But as a reason why we cannot have
> more than one, it is tautological. It merely says "if we start from
> only one and dig history to find older culprit, we need only one
> bad".
>
> I fell asleep last night without thinking further than that.
>
> I think the answer to the question "why do we think we need a single
> bisect/bad?" is "because bisection is about assuming that there is
> only one commit that flips the tree state from 'old' to 'new' and
> finding that single commit". That would mean that even if we had
> bisect/bad-A and bisect/bad-B, e.g.
>
> o---o---o---bad-A
> /
> -----Good---o---o---o
> \
> o---o---o---bad-B
>
>
> where 'o' are all commits whose goodness is not yet known, because
> bisection is valid only when we are hunting for a single commit that
> flips the state from good to bad, that commit MUST be at or before
> the merge base of bad-A and bad-B. So even if we allowed
>
> $ git bisect bad bad-A bad-B
>
> on the command line, we won't have to set bisect/bad-A and
> bisect/bad-B. We only need a single bisect/bad that points at the
> merge base of these two.
>
> But what if bad-A and bad-B have more than one merge bases? We
> won't know which side the badness came from.
>
> o---o---o---bad-A
> / \ /
> -----Good---o---o---o /
> \ / \
> o---o---o---bad-B
>
> Being able to bisect the region of DAG bound by "^Good bad-A bad-B"
> may have value in such a case. I dunno.
I agree that there could be improvements in this area. Though from my
experience with special cases, like when a good commit is not an
ancestor of the bad commit (where there are probably bugs still
lurking), I think it could be tricky to implement correctly in all
cases, and it could make it even more difficult, than it sometimes
already is, to explain the resulting behavior to users.
^ permalink raw reply
* Re: [PATCH 2/3] xdiff: -W: include immediately preceding non-empty lines in context
From: René Scharfe @ 2017-01-15 16:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Vegard Nossum, git
In-Reply-To: <xmqqy3ydcaia.fsf@gitster.mtv.corp.google.com>
Am 15.01.2017 um 03:39 schrieb Junio C Hamano:
> René Scharfe <l.s.r@web.de> writes:
>
>>> I am also more focused on keeping the codebase maintainable in good
>>> health by making sure that we made an effort to find a solution that
>>> is general-enough before solving a single specific problem you have
>>> today. We may end up deciding that a blank-line heuristics gives us
>>> good enough tradeoff, but I do not want us to make a decision before
>>> thinking.
>>
>> How about extending the context upward only up to and excluding a line
>> that is either empty *or* a function line? That would limit the extra
>> context to a single function in the worst case.
>>
>> Reducing context at the bottom with the aim to remove comments for the
>> next section is more tricky as it could remove part of the function
>> that we'd like to show if we get the boundary wrong. How bad would it
>> be to keep the southern border unchanged?
>
> I personally do not think there is any robust heuristic other than
> Vegard's "a blank line may be a signal enough that lines before that
> are not part of the beginning of the function", and I think your
> "hence we look for a blank line but if there is a line that matches
> the function header, stop there as we know we came too far back"
> will be a good-enough safety measure.
>
> I also agree with you that we probably do not want to futz with the
> southern border.
A replacement patch for 2/3 with these changes would look like this:
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index 8c88dbde38..9ed54cd318 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -174,11 +174,11 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
s2 = XDL_MAX(xch->i2 - xecfg->ctxlen, 0);
if (xecfg->flags & XDL_EMIT_FUNCCONTEXT) {
+ char dummy[1];
long fs1, i1 = xch->i1;
/* Appended chunk? */
if (i1 >= xe->xdf1.nrec) {
- char dummy[1];
long i2 = xch->i2;
/*
@@ -200,6 +200,10 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
}
fs1 = get_func_line(xe, xecfg, NULL, i1, -1);
+ while (fs1 > 0 && !is_empty_rec(&xe->xdf1, fs1 - 1) &&
+ match_func_rec(&xe->xdf1, xecfg, fs1 - 1,
+ dummy, sizeof(dummy)) < 0)
+ fs1--;
if (fs1 < 0)
fs1 = 0;
if (fs1 < s1) {
^ permalink raw reply related
* Re: [PATCH 2/3] xdiff: -W: include immediately preceding non-empty lines in context
From: René Scharfe @ 2017-01-15 16:57 UTC (permalink / raw)
To: Vegard Nossum, Junio C Hamano; +Cc: git
In-Reply-To: <0c761135-2696-4b3d-0a4f-3d90edf5da2e@oracle.com>
Am 15.01.2017 um 11:06 schrieb Vegard Nossum:
> On 15/01/2017 03:39, Junio C Hamano wrote:
>> René Scharfe <l.s.r@web.de> writes:
>>> How about extending the context upward only up to and excluding a line
>>> that is either empty *or* a function line? That would limit the extra
>>> context to a single function in the worst case.
>>>
>>> Reducing context at the bottom with the aim to remove comments for the
>>> next section is more tricky as it could remove part of the function
>>> that we'd like to show if we get the boundary wrong. How bad would it
>>> be to keep the southern border unchanged?
>>
>> I personally do not think there is any robust heuristic other than
>> Vegard's "a blank line may be a signal enough that lines before that
>> are not part of the beginning of the function", and I think your
>> "hence we look for a blank line but if there is a line that matches
>> the function header, stop there as we know we came too far back"
>> will be a good-enough safety measure.
>>
>> I also agree with you that we probably do not want to futz with the
>> southern border.
>
> You are right, trying to change the southern border in this way is not
> quite reliable if there are no empty lines whatsoever and can
> erroneously cause the function context to not include the bottom of the
> function being changed.
>
> I'm splitting the function boundary detection logic into separate
> functions and trying to solve the above case without breaking the tests
> (and adding a new test for the above case too).
>
> I'll see if I can additionally provide some toggles (flags or config
> variables) to control the new behaviour, what I had in mind was:
>
> -W[=preamble,=no-preamble]
> --function-context[=preamble,=no-preamble]
> diff.functionContextPreamble = <bool>
>
> (where the new logic is controlled by the new config variable and
> overridden by the presence of =preamble or =no-preamble).
Adding comments before a function is useful, removing comments after a
function sounds to me as only nice to have (under the assumption that
they belong to the next function[*]). How bad would it be to only
implement the first part (as in the patch I just sent) without adding
new config settings or parameters?
Thanks,
René
[*] Silly counter-example (the #endif line):
#ifdef SOMETHING
int f(...) {
// implementation for SOMETHING
}
#else
inf f(...) {
// implementation without SOMETHING
}
#endif /* SOMETHING */
^ permalink raw reply
* [PATCH] request-pull: drop old USAGE stuff
From: Wolfram Sang @ 2017-01-15 17:46 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Wolfram Sang
request-pull uses OPTIONS_SPEC, so no need for (meanwhile incomplete)
USAGE and LONG_USAGE anymore.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
---
git-request-pull.sh | 3 ---
1 file changed, 3 deletions(-)
Index: git-2.11.0/git-request-pull.sh
===================================================================
--- git-2.11.0.orig/git-request-pull.sh
+++ git-2.11.0/git-request-pull.sh
@@ -4,9 +4,6 @@
# This file is licensed under the GPL v2, or a later version
# at the discretion of Linus Torvalds.
-USAGE='<start> <url> [<end>]'
-LONG_USAGE='Summarizes the changes between two commits to the standard output,
-and includes the given URL in the generated summary.'
SUBDIRECTORY_OK='Yes'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
^ permalink raw reply
* [RFC for GIT] pull-request: add praise to people doing QA
From: Wolfram Sang @ 2017-01-15 18:30 UTC (permalink / raw)
To: git, linux-kernel; +Cc: Wolfram Sang
Asking for opinions on lkml and git...
Getting enough quality assurance is likely one of the bigger upcoming tasks in
the near future. To improve the situation, praise the people already doing that
by adding their names to pull requests in the same manner that patch authors
are credited. Here is an example, I sent out today [1]:
=== old stuff
The following changes since commit a121103c922847ba5010819a3f250f1f7fc84ab8:
...
Vlad Tsyrklevich (1):
i2c: fix kernel memory disclosure in dev interface
=== new stuff starts here
with much appreciated quality assurance from
----------------------------------------------------------------
Andy Shevchenko (1):
(Rev.) i2c: piix4: Avoid race conditions with IMC
Benjamin Tissoires (1):
(Test) i2c: do not enable fall back to Host Notify by default
Vladimir Zapolskiy (1):
(Rev.) i2c: print correct device invalid address
=== diffstat, ...
This patch is a very early RFC to collect opinions. I am not very familiar with
the git codebase, but I guess using a filter needs to be reworked, the
dependency on GNU awk may be frowned upon (though 'asorti' is really useful
here), the reg-ex are not super-solid, and it should be a command-line option,
of course. That all being said, it was a fast way to produce what I would like
to add to my pull requests for the i2c subsystem and to see if other kernel/git
maintainers are interested in something like this.
Disclaimer: while this patch applies to the git codebase, I have to admit that
I simply patched around in /usr/lib/git-core of my Debian machine :)
So much for now, let me know what you think,
Wolfram
[1] http://lkml.org/lkml/2017/1/15/55
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
---
git-praise-qa.awk | 33 +++++++++++++++++++++++++++++++++
git-request-pull.sh | 1 +
2 files changed, 34 insertions(+)
Index: git-2.11.0/git-request-pull.sh
===================================================================
--- git-2.11.0.orig/git-request-pull.sh
+++ git-2.11.0/git-request-pull.sh
@@ -155,6 +155,7 @@ then
fi &&
git shortlog ^$baserev $headrev &&
+git log --no-merges ^$baserev $headrev | git-praise-qa.awk &&
git diff -M --stat --summary $patch $merge_base..$headrev || status=1
exit $status
Index: git-2.11.0/git-praise-qa.awk
===================================================================
--- /dev/null
+++ git-2.11.0/git-praise-qa.awk
@@ -0,0 +1,33 @@
+#! /usr/bin/gawk -f
+
+# New commit found, empty subject variable
+/^commit / { subject = "" }
+
+# Grab the subject line
+!subject && /^ / { subject = substr($0, 5); }
+
+# Scan for tags and get the type
+/^ Reviewed-by:/ { type = "Rev." }
+/^ Tested-by:/ { type = "Test" }
+
+type && subject {
+ # Extract the name
+ sub(/^.*: /, ""); sub(/ <.*/, ""); name = $0;
+ # Collect tags given by 'name'
+ tags[name] = tags[name] " (" type ") " subject "\n";
+ count[name]++;
+ # Done, clear flag
+ type = "";
+}
+
+END {
+ print "\nwith much appreciated quality assurance from"
+ print "----------------------------------------------------------------"
+ # Sort by names
+ asorti(tags, sorted_names);
+ # printout in git style
+ for (i in sorted_names) {
+ name = sorted_names[i];
+ print name " (" count[name] "):" "\n" tags[name];
+ }
+}
^ permalink raw reply
* [PATCH v5 0/7] Add --format to tag verification
From: santiago @ 2017-01-15 18:46 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Santiago Torres
From: Santiago Torres <santiago@nyu.edu>
This is the fifth iteration of [1][2][3][4], and as a result of the
discussion in [5]. The main goal of this patch series is to bring
--format to git tag verification so that upper-layer tools can inspect
the content of a tag and make decisions based on it.
In this re-woll we:
* Squashed Peff's first patch[6] with the second patch of the series. The commit
message may need work.
* Applied the relevant segment's of Peff's second patch[7] on the rest of the
series
* Rebased so these patches apply to the tip of the master branch.
Thanks,
-Santiago
[1] http://public-inbox.org/git/20161007210721.20437-1-santiago@nyu.edu/
[2] http://public-inbox.org/git/20160930221806.3398-1-santiago@nyu.edu/
[3] http://public-inbox.org/git/20160922185317.349-1-santiago@nyu.edu/
[4] http://public-inbox.org/git/20160926224233.32702-1-santiago@nyu.edu/
[5] http://public-inbox.org/git/20160607195608.16643-1-santiago@nyu.edu/
[6] http://public-inbox.org/git/20161019203546.dfqmi2czcxopgj6w@sigill.intra.peff.net/
[7] http://public-inbox.org/git/20161019203943.epjxnfci7vcqg4xv@sigill.intra.peff.net/
Lukas Puehringer (4):
gpg-interface, tag: add GPG_VERIFY_QUIET flag
ref-filter: add function to print single ref_array_item
tag: add format specifier to gpg_verify_tag
builtin/tag: add --format argument for tag -v
Santiago Torres (3):
builtin/verify-tag: add --format to verify-tag
t/t7030-verify-tag: Add --format specifier tests
t/t7004-tag: Add --format specifier tests
Documentation/git-tag.txt | 2 +-
Documentation/git-verify-tag.txt | 2 +-
builtin/tag.c | 32 ++++++++++++++++++++++----------
builtin/verify-tag.c | 13 +++++++++++--
gpg-interface.h | 1 +
ref-filter.c | 27 +++++++++++++++++++++------
ref-filter.h | 7 +++++++
t/t7004-tag.sh | 16 ++++++++++++++++
t/t7030-verify-tag.sh | 16 ++++++++++++++++
tag.c | 22 +++++++++++++++-------
tag.h | 4 ++--
11 files changed, 113 insertions(+), 29 deletions(-)
--
2.11.0
^ permalink raw reply
* [PATCH v5 1/7] gpg-interface, tag: add GPG_VERIFY_QUIET flag
From: santiago @ 2017-01-15 18:46 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Lukas Puehringer
In-Reply-To: <20170115184705.10376-1-santiago@nyu.edu>
From: Lukas Puehringer <luk.puehringer@gmail.com>
Functions that print git object information may require that the
gpg-interface functions be silent. Add GPG_VERIFY_QUIET flag and prevent
print_signature_buffer from being called if flag is set.
Signed-off-by: Lukas Puehringer <luk.puehringer@gmail.com>
---
gpg-interface.h | 1 +
tag.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gpg-interface.h b/gpg-interface.h
index ea68885ad..85dc9820d 100644
--- a/gpg-interface.h
+++ b/gpg-interface.h
@@ -3,6 +3,7 @@
#define GPG_VERIFY_VERBOSE 1
#define GPG_VERIFY_RAW 2
+#define GPG_VERIFY_QUIET 4
struct signature_check {
char *payload;
diff --git a/tag.c b/tag.c
index d1dcd18cd..291073f6e 100644
--- a/tag.c
+++ b/tag.c
@@ -3,6 +3,7 @@
#include "commit.h"
#include "tree.h"
#include "blob.h"
+#include "gpg-interface.h"
const char *tag_type = "tag";
@@ -24,7 +25,9 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
ret = check_signature(buf, payload_size, buf + payload_size,
size - payload_size, &sigc);
- print_signature_buffer(&sigc, flags);
+
+ if (!(flags & GPG_VERIFY_QUIET))
+ print_signature_buffer(&sigc, flags);
signature_check_clear(&sigc);
return ret;
--
2.11.0
^ permalink raw reply related
* [PATCH v5 2/7] ref-filter: add function to print single ref_array_item
From: santiago @ 2017-01-15 18:47 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Lukas Puehringer
In-Reply-To: <20170115184705.10376-1-santiago@nyu.edu>
From: Lukas Puehringer <luk.puehringer@gmail.com>
ref-filter functions are useful for printing git object information
using a format specifier. However, some other modules may not want to use
this functionality on a ref-array but only print a single item.
Expose a pretty_print_ref function to create, pretty print and free
individual ref-items.
Signed-off-by: Lukas Puehringer <luk.puehringer@gmail.com>
---
ref-filter.c | 27 +++++++++++++++++++++------
ref-filter.h | 7 +++++++
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/ref-filter.c b/ref-filter.c
index 1a978405e..5f4b08792 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1361,7 +1361,7 @@ static struct ref_array_item *new_ref_array_item(const char *refname,
return ref;
}
-static int filter_ref_kind(struct ref_filter *filter, const char *refname)
+static int ref_kind_from_refname(const char *refname)
{
unsigned int i;
@@ -1374,11 +1374,7 @@ static int filter_ref_kind(struct ref_filter *filter, const char *refname)
{ "refs/tags/", FILTER_REFS_TAGS}
};
- if (filter->kind == FILTER_REFS_BRANCHES ||
- filter->kind == FILTER_REFS_REMOTES ||
- filter->kind == FILTER_REFS_TAGS)
- return filter->kind;
- else if (!strcmp(refname, "HEAD"))
+ if (!strcmp(refname, "HEAD"))
return FILTER_REFS_DETACHED_HEAD;
for (i = 0; i < ARRAY_SIZE(ref_kind); i++) {
@@ -1389,6 +1385,15 @@ static int filter_ref_kind(struct ref_filter *filter, const char *refname)
return FILTER_REFS_OTHERS;
}
+static int filter_ref_kind(struct ref_filter *filter, const char *refname)
+{
+ if (filter->kind == FILTER_REFS_BRANCHES ||
+ filter->kind == FILTER_REFS_REMOTES ||
+ filter->kind == FILTER_REFS_TAGS)
+ return filter->kind;
+ return ref_kind_from_refname(refname);
+}
+
/*
* A call-back given to for_each_ref(). Filter refs and keep them for
* later object processing.
@@ -1671,6 +1676,16 @@ void show_ref_array_item(struct ref_array_item *info, const char *format, int qu
putchar('\n');
}
+void pretty_print_ref(const char *name, const unsigned char *sha1,
+ const char *format)
+{
+ struct ref_array_item *ref_item;
+ ref_item = new_ref_array_item(name, sha1, 0);
+ ref_item->kind = ref_kind_from_refname(name);
+ show_ref_array_item(ref_item, format, 0);
+ free_array_item(ref_item);
+}
+
/* If no sorting option is given, use refname to sort as default */
struct ref_sorting *ref_default_sorting(void)
{
diff --git a/ref-filter.h b/ref-filter.h
index fc55fa357..7b05592ba 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -109,4 +109,11 @@ struct ref_sorting *ref_default_sorting(void);
/* Function to parse --merged and --no-merged options */
int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset);
+/*
+ * Print a single ref, outside of any ref-filter. Note that the
+ * name must be a fully qualified refname.
+ */
+void pretty_print_ref(const char *name, const unsigned char *sha1,
+ const char *format);
+
#endif /* REF_FILTER_H */
--
2.11.0
^ permalink raw reply related
* [PATCH v5 7/7] t/t7004-tag: Add --format specifier tests
From: santiago @ 2017-01-15 18:47 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Santiago Torres
In-Reply-To: <20170115184705.10376-1-santiago@nyu.edu>
From: Santiago Torres <santiago@nyu.edu>
tag -v now supports --format specifiers to inspect the contents of a tag
upon verification. Add two tests to ensure this behavior is respected in
future changes.
Signed-off-by: Santiago Torres <santiago@nyu.edu>
---
t/t7004-tag.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 07869b0c0..b2b81f203 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -874,6 +874,22 @@ test_expect_success GPG 'verifying a forged tag should fail' '
test_must_fail git tag -v forged-tag
'
+test_expect_success 'verifying a proper tag with --format pass and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : signed-tag
+ EOF &&
+ git tag -v --format="tagname : %(tag)" "signed-tag" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : forged-tag
+ EOF &&
+ test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
+ test_cmp expect actual
+'
+
# blank and empty messages for signed tags:
get_tag_header empty-signed-tag $commit commit $time >expect
--
2.11.0
^ permalink raw reply related
* [PATCH v5 6/7] t/t7030-verify-tag: Add --format specifier tests
From: santiago @ 2017-01-15 18:47 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Santiago Torres
In-Reply-To: <20170115184705.10376-1-santiago@nyu.edu>
From: Santiago Torres <santiago@nyu.edu>
Verify-tag now provides --format specifiers to inspect and ensure the
contents of the tag are proper. We add two tests to ensure this
functionality works as expected: the return value should indicate if
verification passed, and the format specifiers must be respected.
Signed-off-by: Santiago Torres <santiago@nyu.edu>
---
t/t7030-verify-tag.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index 07079a41c..d62ccbb98 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -125,4 +125,20 @@ test_expect_success GPG 'verify multiple tags' '
test_cmp expect.stderr actual.stderr
'
+test_expect_success 'verifying tag with --format' '
+ cat >expect <<-\EOF
+ tagname : fourth-signed
+ EOF &&
+ git verify-tag --format="tagname : %(tag)" "fourth-signed" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
+ cat >expect <<-\EOF
+ tagname : 7th forged-signed
+ EOF &&
+ test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag) >actual-forged &&
+ test_cmp expect actual-forged
+'
+
test_done
--
2.11.0
^ permalink raw reply related
* [PATCH v5 5/7] builtin/tag: add --format argument for tag -v
From: santiago @ 2017-01-15 18:47 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Lukas Puehringer
In-Reply-To: <20170115184705.10376-1-santiago@nyu.edu>
From: Lukas Puehringer <luk.puehringer@gmail.com>
Adding --format to git tag -v mutes the default output of the GPG
verification and instead prints the formatted tag object.
This allows callers to cross-check the tagname from refs/tags with
the tagname from the tag object header upon GPG verification.
The callback function for for_each_tag_name() didn't allow callers to
pass custom data to their callback functions. Add a new opaque pointer
to each_tag_name_fn's parameter to allow this.
Signed-off-by: Lukas Puehringer <luk.puehringer@gmail.com>
---
Documentation/git-tag.txt | 2 +-
builtin/tag.c | 32 ++++++++++++++++++++++----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 76cfe40d9..586aaa315 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -15,7 +15,7 @@ SYNOPSIS
'git tag' [-n[<num>]] -l [--contains <commit>] [--points-at <object>]
[--column[=<options>] | --no-column] [--create-reflog] [--sort=<key>]
[--format=<format>] [--[no-]merged [<commit>]] [<pattern>...]
-'git tag' -v <tagname>...
+'git tag' -v [--format=<format>] <tagname>...
DESCRIPTION
-----------
diff --git a/builtin/tag.c b/builtin/tag.c
index 880677df5..9da11e0c2 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -24,7 +24,7 @@ static const char * const git_tag_usage[] = {
N_("git tag -d <tagname>..."),
N_("git tag -l [-n[<num>]] [--contains <commit>] [--points-at <object>]"
"\n\t\t[--format=<format>] [--[no-]merged [<commit>]] [<pattern>...]"),
- N_("git tag -v <tagname>..."),
+ N_("git tag -v [--format=<format>] <tagname>..."),
NULL
};
@@ -66,15 +66,17 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, con
}
typedef int (*each_tag_name_fn)(const char *name, const char *ref,
- const unsigned char *sha1);
+ const unsigned char *sha1, void *cb_data);
-static int for_each_tag_name(const char **argv, each_tag_name_fn fn)
+static int for_each_tag_name(const char **argv, each_tag_name_fn fn,
+ void *cb_data)
{
const char **p;
char ref[PATH_MAX];
int had_error = 0;
unsigned char sha1[20];
+
for (p = argv; *p; p++) {
if (snprintf(ref, sizeof(ref), "refs/tags/%s", *p)
>= sizeof(ref)) {
@@ -87,14 +89,14 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn)
had_error = 1;
continue;
}
- if (fn(*p, ref, sha1))
+ if (fn(*p, ref, sha1, cb_data))
had_error = 1;
}
return had_error;
}
static int delete_tag(const char *name, const char *ref,
- const unsigned char *sha1)
+ const unsigned char *sha1, void *cb_data)
{
if (delete_ref(ref, sha1, 0))
return 1;
@@ -103,9 +105,16 @@ static int delete_tag(const char *name, const char *ref,
}
static int verify_tag(const char *name, const char *ref,
- const unsigned char *sha1)
+ const unsigned char *sha1, void *cb_data)
{
- return verify_and_format_tag(sha1, name, NULL, GPG_VERIFY_VERBOSE);
+ int flags;
+ char *fmt_pretty = cb_data;
+ flags = GPG_VERIFY_VERBOSE;
+
+ if (fmt_pretty)
+ flags = GPG_VERIFY_QUIET;
+
+ return verify_and_format_tag(sha1, ref, fmt_pretty, flags);
}
static int do_sign(struct strbuf *buffer)
@@ -428,9 +437,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
if (filter.merge_commit)
die(_("--merged and --no-merged option are only allowed with -l"));
if (cmdmode == 'd')
- return for_each_tag_name(argv, delete_tag);
- if (cmdmode == 'v')
- return for_each_tag_name(argv, verify_tag);
+ return for_each_tag_name(argv, delete_tag, NULL);
+ if (cmdmode == 'v') {
+ if (format)
+ verify_ref_format(format);
+ return for_each_tag_name(argv, verify_tag, format);
+ }
if (msg.given || msgfile) {
if (msg.given && msgfile)
--
2.11.0
^ permalink raw reply related
* [PATCH v5 3/7] tag: add format specifier to gpg_verify_tag
From: santiago @ 2017-01-15 18:47 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Lukas Puehringer
In-Reply-To: <20170115184705.10376-1-santiago@nyu.edu>
From: Lukas Puehringer <luk.puehringer@gmail.com>
Calling functions for gpg_verify_tag() may desire to print relevant
information about the header for further verification. Add an optional
format argument to print any desired information after GPG verification.
Signed-off-by: Lukas Puehringer <luk.puehringer@gmail.com>
---
builtin/tag.c | 2 +-
builtin/verify-tag.c | 2 +-
tag.c | 17 +++++++++++------
tag.h | 4 ++--
4 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index 73df72811..880677df5 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -105,7 +105,7 @@ static int delete_tag(const char *name, const char *ref,
static int verify_tag(const char *name, const char *ref,
const unsigned char *sha1)
{
- return gpg_verify_tag(sha1, name, GPG_VERIFY_VERBOSE);
+ return verify_and_format_tag(sha1, name, NULL, GPG_VERIFY_VERBOSE);
}
static int do_sign(struct strbuf *buffer)
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index 99f8148cf..de10198c4 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -51,7 +51,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
const char *name = argv[i++];
if (get_sha1(name, sha1))
had_error = !!error("tag '%s' not found.", name);
- else if (gpg_verify_tag(sha1, name, flags))
+ else if (verify_and_format_tag(sha1, name, NULL, flags))
had_error = 1;
}
return had_error;
diff --git a/tag.c b/tag.c
index 291073f6e..d5a7cfb20 100644
--- a/tag.c
+++ b/tag.c
@@ -4,6 +4,7 @@
#include "tree.h"
#include "blob.h"
#include "gpg-interface.h"
+#include "ref-filter.h"
const char *tag_type = "tag";
@@ -33,8 +34,8 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
return ret;
}
-int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,
- unsigned flags)
+int verify_and_format_tag(const unsigned char *sha1, const char *name,
+ const char *fmt_pretty, unsigned flags)
{
enum object_type type;
char *buf;
@@ -44,21 +45,25 @@ int gpg_verify_tag(const unsigned char *sha1, const char *name_to_report,
type = sha1_object_info(sha1, NULL);
if (type != OBJ_TAG)
return error("%s: cannot verify a non-tag object of type %s.",
- name_to_report ?
- name_to_report :
+ name ?
+ name :
find_unique_abbrev(sha1, DEFAULT_ABBREV),
typename(type));
buf = read_sha1_file(sha1, &type, &size);
if (!buf)
return error("%s: unable to read file.",
- name_to_report ?
- name_to_report :
+ name ?
+ name :
find_unique_abbrev(sha1, DEFAULT_ABBREV));
ret = run_gpg_verify(buf, size, flags);
free(buf);
+
+ if (fmt_pretty)
+ pretty_print_ref(name, sha1, fmt_pretty);
+
return ret;
}
diff --git a/tag.h b/tag.h
index a5721b673..896b9c2dc 100644
--- a/tag.h
+++ b/tag.h
@@ -17,7 +17,7 @@ extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long si
extern int parse_tag(struct tag *item);
extern struct object *deref_tag(struct object *, const char *, int);
extern struct object *deref_tag_noverify(struct object *);
-extern int gpg_verify_tag(const unsigned char *sha1,
- const char *name_to_report, unsigned flags);
+extern int verify_and_format_tag(const unsigned char *sha1, const char *name,
+ const char *fmt_pretty, unsigned flags);
#endif /* TAG_H */
--
2.11.0
^ permalink raw reply related
* [PATCH v5 4/7] builtin/verify-tag: add --format to verify-tag
From: santiago @ 2017-01-15 18:47 UTC (permalink / raw)
To: git; +Cc: gitster, peff, sunshine, walters, Santiago Torres
In-Reply-To: <20170115184705.10376-1-santiago@nyu.edu>
From: Santiago Torres <santiago@nyu.edu>
Callers of verify-tag may want to cross-check the tagname from refs/tags
with the tagname from the tag object header upon GPG verification. This
is to avoid tag refs that point to an incorrect object.
Add a --format parameter to git verify-tag to print the formatted tag
object header in addition to or instead of the --verbose or --raw GPG
verification output.
Signed-off-by: Santiago Torres <santiago@nyu.edu>
---
Documentation/git-verify-tag.txt | 2 +-
builtin/verify-tag.c | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-verify-tag.txt b/Documentation/git-verify-tag.txt
index d590edceb..0b8075dad 100644
--- a/Documentation/git-verify-tag.txt
+++ b/Documentation/git-verify-tag.txt
@@ -8,7 +8,7 @@ git-verify-tag - Check the GPG signature of tags
SYNOPSIS
--------
[verse]
-'git verify-tag' <tag>...
+'git verify-tag' [--format=<format>] <tag>...
DESCRIPTION
-----------
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index de10198c4..212449f47 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -12,12 +12,14 @@
#include <signal.h>
#include "parse-options.h"
#include "gpg-interface.h"
+#include "ref-filter.h"
static const char * const verify_tag_usage[] = {
- N_("git verify-tag [-v | --verbose] <tag>..."),
+ N_("git verify-tag [-v | --verbose] [--format=<format>] <tag>..."),
NULL
};
+
static int git_verify_tag_config(const char *var, const char *value, void *cb)
{
int status = git_gpg_config(var, value, cb);
@@ -30,9 +32,11 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
unsigned flags = 0;
+ char *fmt_pretty = NULL;
const struct option verify_tag_options[] = {
OPT__VERBOSE(&verbose, N_("print tag contents")),
OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW),
+ OPT_STRING( 0 , "format", &fmt_pretty, N_("format"), N_("format to use for the output")),
OPT_END()
};
@@ -46,12 +50,17 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
if (verbose)
flags |= GPG_VERIFY_VERBOSE;
+ if (fmt_pretty) {
+ verify_ref_format(fmt_pretty);
+ flags |= GPG_VERIFY_QUIET;
+ }
+
while (i < argc) {
unsigned char sha1[20];
const char *name = argv[i++];
if (get_sha1(name, sha1))
had_error = !!error("tag '%s' not found.", name);
- else if (verify_and_format_tag(sha1, name, NULL, flags))
+ else if (verify_and_format_tag(sha1, name, fmt_pretty, flags))
had_error = 1;
}
return had_error;
--
2.11.0
^ permalink raw reply related
* Re: submodule network operations [WAS: Re: [RFC/PATCH 0/4] working tree operations: support superprefix]
From: Brian J. Davis @ 2017-01-15 21:02 UTC (permalink / raw)
To: Stefan Beller; +Cc: Brandon Williams, git@vger.kernel.org, David Turner
In-Reply-To: <CAGZ79kZRV7x9B6SHRcHjJweHrjURxWKmN-=Wz_aNw2TPwYh_xw@mail.gmail.com>
On 1/13/2017 12:30 PM, Stefan Beller wrote:
> This question is about networking; the patch you originally replied to
> was strictly about local operations in the filesystem, which is quite
> a difference, so let's discuss it separately.
Yep ok look like you reclassified this and opened new topic which I hope
I am responding to correctly now.
> On Fri, Jan 13, 2017 at 9:56 AM, Brian J. Davis <bitminer@gmail.com> wrote:
>> In response to a post at:
>>
>> https://groups.google.com/forum/#!topic/git-users/BVLcKHhSUKo
>>
>> I was asked to post here to explain a potential problem with current modules
>> implementation. Apologies if I am posting in the wrong place... so good bad
>> or otherwise here goes:
>>
>> +-------------------------------
>> With:
>>
>> git push origin branchname
>>
>> or
>>
>> git push server2 branchname
>>
>> I can push or pull from multiple servers so no problem as git supports this.
>>
>> Now the problem with use of submodules
>>
>> submodules are listed:
>>
>> submodule.directory_to_
>> checkout/proj1_dir.url=https://git.someserver1/git/proj1_dir
>> <https://git.someserver1/git/proj1_dir>
> Technically it is submodule.<name>.url instead of
> submodule.<path>.url. The name is usually the path initially, and once
> you move the submodule, only the path changes, the name is supposed to
> be constant and stay the same.
I am not certain what is meant by this. All I know is I can use my
"directory_to_checkout" above to place in tree relative from root the
project any where in the tree not already tracked by git. You state
name instead of path, but it allows path correct? Either that or I have
gone off reservation with my use of git for years now. Maybe this is a
deviation from how it is documented/should work and how it actually
works? It works great how I use it.
>>
>> but if say I want to pull from some server 2 and do a
>>
>> git submodule update --init --recursive
> That is why the "git submodule init" exists at all.
>
> git submodule init
> $EDIT .git/config # change submodule.<name>.url to server2
> git submodule update # that uses the adapted url and
> # creates the submodule repository.
>
> # From now on the submodule is on its own.
> cd <submodule> && git config --list
> # prints an "origin" remote and a lot more
>
> For a better explanation, I started a documentation series, see
> https://github.com/gitster/git/commit/e2b51b9df618ceeff7c4ec044e20f5ce9a87241e
>
> (It is not finished, but that is supposed to explain this exact pain
> point in the
> STATES section, feel free to point out missing things or what is hard
> to understand)
I am not sure I got much out of the STATES section regarding my problem.
>> what I would get is from someserver1 not someserver2 as there is no "origin"
>> support for submodules. Is this correct? If so can origin support be added
>> to submodules?
> Can you explain more in detail what you mean by origin support?
Yes so when we do a:
git push origin master
origin is of course the Remote (Remotes
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)
So I best use terminology "Remotes" support. Git push supports remotes,
but git submodules does not. The basic idea is this:
If Git allowed multiple submodule
(https://git-scm.com/book/en/v2/Git-Tools-Submodules) Remotes to be
specified say as an example:
git submodule add [remote] [url]
git submodule add origin https://github.com/chaconinc/DbConnector
git submodule add indhouse https://indhouse .corp/chaconinc/DbConnector
Where:
[submodule "DbConnector"]
path = DbConnector
url = https://github.com/chaconinc/DbConnector
Could then change to:
[submodule "DbConnector"]
path = DbConnector
remote.origin.url = https://github.com/chaconinc/DbConnector
remote.origin.url = https://indhouse .corp/chaconinc/DbConnector
Then it should be possible to get:
git submodules update --init --recursive
To support
git submodules update [remote] --init --recursive
And thus allow
git submodules update origin --init --recursive
git submodules update indhouse --init --recursive
>
>> +-------------------------------
>>
>> So above was post from google group. Maybe above is enough to explain the
>> problem that can result, but if not here is a discussion as to why this can
>> be confusing resulting to pushing or pulling from the incorrect server.
>>
>> Lets say projects starts at origin on https://server0.org. Project is then
>> brought in house to server https://indhouse.corp by developer A.
>>
>> Developer A then changes the submodule projects to point to indhouse and
>> changes submodules in super project to point to indhouse so everything is
>> great.
>>
>> Then Developer B clones from indhouse makes changes to submodule1 and
>> submodule1 and pushes them to indhouse. Dev A tells Dev B hey thoes changes
>> are great why don't you push to public server0 so every one can get thoes
>> changes. Dev B then git push origin branch_name on submodule1 and push
>> origin on submodule 2 and superproject. And everything is great ... right?
>>
>> Yes by now those who know git know what dev B forgot or more to the point
>> what git does not support in a "clean" way. For those who don't enter the
>> life of dev C
>>
>> So dev C clones from server0 and performs a git submodule update --init
>> --recursive. Now Dev C is on the www and can't see indhouse.corp and ...
>> kerpow... Dev B and Dev C just experienced one of the many SW mines on the
>> battlefield.
>>
>> I ask that git devs first see if I am correct with this assessment as I
>> could be wrong... maybe there is a way of doing this... and if not add a
>> feature to git to handle submodules and multiple origins cleanly.... and yes
>> beating dev B with rubber chicken might be a solution though I am looking
>> for a slightly better option.
> Yes this is a big point that we want to solve eventually.
>
> When devA brought it inhouse, what they meant to do was this:
> "This superproject is actually from server0, but we want to work on it, which
> may have submodules diverge from server0 eventually. So if a submodule changed
> you need to get it from the inhouse server, otherwise fall back to the server0".
>
> That way developerB can just make changes to some submodules and when
> devC clones
> they get the "correct" submodule.
>
> A weak attempt to do this is to use *relative* submodule urls. When
> using relative urls, and then mirroring the supeproject inhouse, then
> Git will look for the submodules as well inhouse, but there
> is no such "or if not found look at the original superprojects
> origin", which means, you have to mirror all submodules.
Yes I don't see how *relative* urls are a good solution.
> And then about upstreaming changes. If you have a single repo (no
> submodules), you have to teach people to run "git remote add remote
> server0.org && git push upstream ...", but that you can do for each
> submodule. (This is tedious:/ but maybe ok; some submodules are free
> to sent things upstream whereas others are supersecret that you do not
> want to push upstream ever.)
So right yes there are ways and means this can fail and not be
ultimately what the developer wants after all we all need to be aware of
the repercussion of the commands typed at the terminal. My goal here is
I notice a process that Git does not seem to handle well for a
distributed revision control system and thought it could use some
improvements. To your point on "supersecret" .... when pushing to
origin git could always be allowed to notify the developer of multi
remotes before pushing with a "freak-out" flag set by Dev A where git
would then ask:
git: are you sure [y/(n)] y
git: are you sure your sure [y/(n)] Y
git :you seem certain, but you might not be aware of the true
consequences of your actions... are you sure you are sure that your are
sure [Y/(N)] Y
git: ..... Ok committing... it's your fault if this goes pear shaped
sideways.
> So yeah maybe we want to have more power in the superprojects push operation
>
> (in the superproject) $ git push --recurse-submodules \
> --only-these-submodules=subA,subB \
> --submodule-to=upstream-as-configered-in-super-project
Sure ... Yes... plus "Remotes" support.
git push --recurse-submodules \
--only-these-submodules=subA,subB \
--submodule-to=upstream-as-configered-in-super-project
Allow:
git push [remote] --recurse-submodules \
--only-these-submodules=subA,subB \
--submodule-to=upstream-as-configered-in-super-project
git push indhouse --recurse-submodules \
--only-these-submodules=subA,subB \
--submodule-to=upstream-as-configered-in-super-project
and
git push origin --recurse-submodules \
--only-these-submodules=subA,subB \
--submodule-to=upstream-as-configered-in-super-project
> This is a lot of words but for explaining that is ok?
>
> Thanks,
> Stefan
Yep got it thanks.
^ permalink raw reply
* [PATCH v3 0/2] diff orderfile documentation improvements
From: Richard Hansen @ 2017-01-15 22:16 UTC (permalink / raw)
To: git; +Cc: gitster
In-Reply-To: <20170111015720.111223-1-hansenr@google.com>
Changes from v2:
* The orderfile feature doesn't set the WM_PATHNAME flag when it
calls wildmatch(), so document the pattern format accordingly.
Richard Hansen (2):
diff: document behavior of relative diff.orderFile
diff: document the format of the -O (diff.orderFile) file
Documentation/diff-config.txt | 7 ++++---
Documentation/diff-options.txt | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 5 deletions(-)
--
2.11.0.483.g087da7b7c-goog
^ permalink raw reply
* [PATCH v3 1/2] diff: document behavior of relative diff.orderFile
From: Richard Hansen @ 2017-01-15 22:16 UTC (permalink / raw)
To: git; +Cc: gitster
In-Reply-To: <20170115221631.78838-1-hansenr@google.com>
Document that a relative pathname for diff.orderFile is interpreted as
relative to the top-level work directory.
Signed-off-by: Richard Hansen <hansenr@google.com>
---
Documentation/diff-config.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
index 58f4bd6af..875212045 100644
--- a/Documentation/diff-config.txt
+++ b/Documentation/diff-config.txt
@@ -101,6 +101,8 @@ diff.noprefix::
diff.orderFile::
File indicating how to order files within a diff, using
one shell glob pattern per line.
+ If `diff.orderFile` is a relative pathname, it is treated as
+ relative to the top of the work tree.
Can be overridden by the '-O' option to linkgit:git-diff[1].
diff.renameLimit::
--
2.11.0.483.g087da7b7c-goog
^ permalink raw reply related
* [PATCH v3 2/2] diff: document the format of the -O (diff.orderFile) file
From: Richard Hansen @ 2017-01-15 22:16 UTC (permalink / raw)
To: git; +Cc: gitster
In-Reply-To: <20170115221631.78838-1-hansenr@google.com>
Signed-off-by: Richard Hansen <hansenr@google.com>
---
Documentation/diff-config.txt | 5 ++---
Documentation/diff-options.txt | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
index 875212045..9e4111320 100644
--- a/Documentation/diff-config.txt
+++ b/Documentation/diff-config.txt
@@ -99,11 +99,10 @@ diff.noprefix::
If set, 'git diff' does not show any source or destination prefix.
diff.orderFile::
- File indicating how to order files within a diff, using
- one shell glob pattern per line.
+ File indicating how to order files within a diff.
+ See the '-O' option to linkgit:git-diff[1] for details.
If `diff.orderFile` is a relative pathname, it is treated as
relative to the top of the work tree.
- Can be overridden by the '-O' option to linkgit:git-diff[1].
diff.renameLimit::
The number of files to consider when performing the copy/rename
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index e6215c372..d4fb70704 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -466,11 +466,41 @@ information.
endif::git-format-patch[]
-O<orderfile>::
- Output the patch in the order specified in the
- <orderfile>, which has one shell glob pattern per line.
+ Control the order in which files appear in the output.
This overrides the `diff.orderFile` configuration variable
(see linkgit:git-config[1]). To cancel `diff.orderFile`,
use `-O/dev/null`.
++
+The output order is determined by the order of glob patterns in
+<orderfile>.
+All files with pathnames that match the first pattern are output
+first, all files with pathnames that match the second pattern (but not
+the first) are output next, and so on.
+All files with pathnames that do not match any pattern are output
+last, as if there was an implicit match-all pattern at the end of the
+file.
+If multiple pathnames have the same rank (they match the same pattern
+but no earlier patterns), their output order relative to each other is
+the normal order.
++
+<orderfile> is parsed as follows:
++
+--
+ - Blank lines are ignored, so they can be used as separators for
+ readability.
+
+ - Lines starting with a hash ("`#`") are ignored, so they can be used
+ for comments. Add a backslash ("`\`") to the beginning of the
+ pattern if it starts with a hash.
+
+ - Each other line contains a single pattern.
+--
++
+Patterns have the same syntax and semantics as patterns used for
+fnmantch(3) without the FNM_PATHNAME flag, except a pathname also
+matches a pattern if removing any number of the final pathname
+components matches the pattern. For example, the pattern "`foo*bar`"
+matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
ifndef::git-format-patch[]
-R::
--
2.11.0.483.g087da7b7c-goog
^ permalink raw reply related
* Re: [PATCH 2/3] xdiff: -W: include immediately preceding non-empty lines in context
From: Junio C Hamano @ 2017-01-15 23:28 UTC (permalink / raw)
To: René Scharfe; +Cc: Vegard Nossum, git
In-Reply-To: <2668771d-249b-659d-3a2c-a788d7d5ebd6@web.de>
René Scharfe <l.s.r@web.de> writes:
> ... How bad would it be to only
> implement the first part (as in the patch I just sent) without adding
> new config settings or parameters?
That probably is a good place to stop ;-)
^ permalink raw reply
* Re: [PATCH 00/27] Revamp the attribute system; another round
From: Junio C Hamano @ 2017-01-15 23:47 UTC (permalink / raw)
To: Brandon Williams, Jeff King; +Cc: git, pclouds, sbeller
In-Reply-To: <20170112235354.153403-1-bmwill@google.com>
This one unfortunately clashes with jk/nofollow-attr-ignore where
Peff adds sanity to refuse following symbolic links when reading
.gitignore and .gitattributes; I'll eject jk/nofollow-attr-ignore
topic for now and see how well this topic fits together with the
remainder of the topics in flight.
Thanks.
^ permalink raw reply
* [RFC] stash --continue
From: Stephan Beyer @ 2017-01-15 23:56 UTC (permalink / raw)
To: git
Hi,
a git-newbie-ish co-worker uses git-stash sometimes. Last time he used
"git stash pop", he got into a merge conflict. After he resolved the
conflict, he did not know what to do to get the repository into the
wanted state. In his case, it was only "git add <resolved files>"
followed by a "git reset" and a "git stash drop", but there may be more
involved cases when your index is not clean before "git stash pop" and
you want to have your index as before.
This led to the idea to have something like "git stash --continue"[1]
that would expect the user to "git add" the resolved files (as "git
status" suggests) but then leads to the expected result, i.e. the index
being the same as before the conflict, the stash being dropped (if "pop"
was used instead of "apply"), etc.
Likewise, some "git stash --abort"[2] might be useful in case you did
"git stash pop" with the wrong stash in mind.
What do you think about that?
Although I think this would be a nice-to-have feature, I am not totally
sure how to achieve backwards-compatibility, i.e., such that using
--continue is still optional... (I think that "git stash apply" would
surely generate auxiliary data in case of a conflict and --continue or
--abort would remove it...)
Best
Stephan
Footnotes
1. Perhaps with a better name, because it does not really continue.
Maybe a "git stash conflict [--resolved]" subcommand?
2. Along the lines of [1], one could use "git stash conflict --abort"?
^ permalink raw reply
* Re: [RFC] stash: support filename argument
From: Junio C Hamano @ 2017-01-16 0:21 UTC (permalink / raw)
To: Thomas Gummerer; +Cc: git, kes-kes
In-Reply-To: <20170115142542.11999-1-t.gummerer@gmail.com>
Thomas Gummerer <t.gummerer@gmail.com> writes:
> While working on a repository, it's often helpful to stash the changes
> of a single or multiple files, and leave others alone. Unfortunately
> git currently offers no such option. git stash -p can be used to work
> around this, but it's often impractical when there are a lot of changes
> over multiple files.
>
> Add a --file option to git stash save, which allows for stashing a
> single file. Specifying the --file argument multiple times allows
> stashing more than one file at a time.
>
> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
> ---
>
> Marked as RFC and without documentation updates to first get a feeling
> for the user interface, and whether people are interested in this
> change.
>
> Ideally I wanted the the user interface to look like something like:
> git stash save -- [<filename1,...>], but unfortunately that's already
> taken up by the stash message. So to preserve backward compatibility
> I used the new --file argument.
I haven't spent enough time to think if it even makes sense to
"stash" partially, leaving the working tree still dirty. My initial
reaction was "then stashing away the dirty WIP state to get a spiffy
clean working environment becomes impossible", and I still need time
to recover from that ;-) So as to the desirablity of this "feature",
I have no strong opinion for or against yet.
But if we were to do this, then we should bite the bullet and
declare that "stash save <message>" was a mistake. It should have
been "stash save -m <message>" and we should transition to that (one
easy way out would be to find another verb that is not 'save').
Then we can do "git stash save [-m <msg>] [--] [pathspec...]" which
follows the usual command line convention.
^ permalink raw reply
* Re: [PATCH] request-pull: drop old USAGE stuff
From: Junio C Hamano @ 2017-01-16 0:23 UTC (permalink / raw)
To: Wolfram Sang; +Cc: git
In-Reply-To: <20170115174635.2422-1-wsa@the-dreams.de>
Wolfram Sang <wsa@the-dreams.de> writes:
> request-pull uses OPTIONS_SPEC, so no need for (meanwhile incomplete)
> USAGE and LONG_USAGE anymore.
>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> ---
Makes sense. These are not used anywhere after we switched to use
parse-options.
Thanks.
>
> git-request-pull.sh | 3 ---
> 1 file changed, 3 deletions(-)
>
> Index: git-2.11.0/git-request-pull.sh
> ===================================================================
> --- git-2.11.0.orig/git-request-pull.sh
> +++ git-2.11.0/git-request-pull.sh
> @@ -4,9 +4,6 @@
> # This file is licensed under the GPL v2, or a later version
> # at the discretion of Linus Torvalds.
>
> -USAGE='<start> <url> [<end>]'
> -LONG_USAGE='Summarizes the changes between two commits to the standard output,
> -and includes the given URL in the generated summary.'
> SUBDIRECTORY_OK='Yes'
> OPTIONS_KEEPDASHDASH=
> OPTIONS_STUCKLONG=
^ permalink raw reply
* Re: [RFC for GIT] pull-request: add praise to people doing QA
From: Junio C Hamano @ 2017-01-16 0:35 UTC (permalink / raw)
To: Wolfram Sang; +Cc: git, linux-kernel
In-Reply-To: <20170115183051.3565-1-wsa@the-dreams.de>
Wolfram Sang <wsa@the-dreams.de> writes:
> === new stuff starts here
>
> with much appreciated quality assurance from
> ----------------------------------------------------------------
> Andy Shevchenko (1):
> (Rev.) i2c: piix4: Avoid race conditions with IMC
>
> Benjamin Tissoires (1):
> (Test) i2c: do not enable fall back to Host Notify by default
>
> Vladimir Zapolskiy (1):
> (Rev.) i2c: print correct device invalid address
>
> === diffstat, ...
>
> This patch is a very early RFC to collect opinions. I am not very familiar with
> the git codebase, but I guess using a filter needs to be reworked, the
> dependency on GNU awk may be frowned upon (though 'asorti' is really useful
> here), the reg-ex are not super-solid, and it should be a command-line option,
> of course. That all being said, it was a fast way to produce what I would like
> to add to my pull requests for the i2c subsystem and to see if other kernel/git
> maintainers are interested in something like this.
>
> Disclaimer: while this patch applies to the git codebase, I have to admit that
> I simply patched around in /usr/lib/git-core of my Debian machine :)
>
> So much for now, let me know what you think,
So the idea is to have list of those whose names appear on
Reviewed-by: and Tested-by: collected and listed after the list of
commit titles and author names. I personally do not see much
downsides in doing so, but I do not consume that many PRs myself, so
let's hear from those who actually do process many of them.
As to the implementation, I am wondering if we can make this somehow
work well with the "trailers" code we already have, instead of
inventing yet another parser of trailers.
In its current shape, "interpret-trailers" focuses on "editing" an
existing commit log message to tweak the trailer lines. That mode
of operation would help amending and rebasing, and to do that it
needs to parse the commit log message, identify trailer blocks,
parse out each trailer lines, etc.
There is no fundamental reason why its output must be an edited
original commit log message---it should be usable as a filter that
picks trailer lines of the selected trailer type, like "Tested-By",
etc.
^ permalink raw reply
* Re: [RFC] stash: support filename argument
From: Stephan Beyer @ 2017-01-16 0:41 UTC (permalink / raw)
To: Junio C Hamano, Thomas Gummerer; +Cc: git, kes-kes
In-Reply-To: <xmqqvatfc0rt.fsf@gitster.mtv.corp.google.com>
Hi,
On 01/16/2017 01:21 AM, Junio C Hamano wrote:
> I haven't spent enough time to think if it even makes sense to
> "stash" partially, leaving the working tree still dirty. My initial
> reaction was "then stashing away the dirty WIP state to get a spiffy
> clean working environment becomes impossible", and I still need time
> to recover from that ;-) So as to the desirablity of this "feature",
> I have no strong opinion for or against yet.
I do remember that I simulated that feature a few times (either by
adding the to-be-keep stuff (hunks, not only files) to the index and use
--keep-index, and sometimes by making a temporary commit (to make sure
to not lose anything) and then stash). So I think there is a valid
desire of the feature.
However, going further, the next feature to be requested could be "git
stash --patch" ;D This leads me to think that the mentioned simulation
of partial stashes might be something everyone might come up with who
has basic understanding of git features and "git stash", and might be
the more flexible and probably better solution to the problem.
Best
Stephan
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox