* Re: Git v2.11.0 breaks max depth nested alternates
From: Kyle J. McKay @ 2016-12-04 9:37 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Git mailing list
In-Reply-To: <20161204045554.advzvylytdmt2bh2@sigill.intra.peff.net>
On Dec 3, 2016, at 20:55, Jeff King wrote:
> So I do think this is worth dealing with, but I'm also curious why
> you're hitting the depth-5 limit. I'm guessing it has to do with
> hosting
> a hierarchy of related repos. But is your system then always in danger
> of busting the 5-limit if people create too deep a repository
> hierarchy?
No we check for the limit. Anything at the limit gets broken by the
quarantine change though.
> Specifically, I'm wondering if it would be sufficient to just bump
> it to
> 6. Or 100.
Well, if we left the current limit in place, but as you say:
> Of course any static bump runs into the funny case where a repo
> _usually_ works, but fails when pushed to. Which is kind of nasty and
> unintuitive. And your patch fixes that,
Yes. That's not nice, hence the patch. Without the fix, pushing
might work sometimes until you actually need to access cut-off objects
at pre-receive time. So you might be able to push sometimes and
sometimes it breaks.
> and we can leave the idea of
> bumping the static depth number as an orthogonal issue (that
> personally,
> I do not care about much about either way).
The patch is a step on that road. It doesn't go that far but all it
would take is connecting the introduced variable to a config item.
But you still need to bump it by 1 during quarantine operations. Such
support would even allow alternates to be disallowed (except during
quarantine). I wonder if there's an opportunity for further pack
operation optimizations in such a case (you know there are no
alternates because they're not allowed)?
>> diff --git a/common-main.c b/common-main.c
>> index c654f955..9f747491 100644
>> --- a/common-main.c
>> +++ b/common-main.c
>> @@ -37,5 +37,8 @@ int main(int argc, const char **argv)
>>
>> restore_sigpipe_to_default();
>>
>> + if (getenv(GIT_QUARANTINE_ENVIRONMENT))
>> + alt_odb_max_depth++;
>> +
>> return cmd_main(argc, argv);
>
> After reading your problem description, my initial thought was to
> increment the counter when we allocate the tmp-objdir, and decrement
> when it is destroyed. Because the parent receive-pack process adds
> it to
> its alternates, too. But:
>
> 1. Receive-pack doesn't care; it adds the tmp-objdir as an alternate,
> rather than adding it as its main object dir and bumping down the
> main one.
>
> 2. There would have to be some way of communicating to sub-processes
> that they should bump their max-depth by one.
All true. And I had similar thoughts. Perhaps we should add your
comments to the patch description? There seems to be a trend towards
having longer patch descriptions these days... ;)
> You've basically used the quarantine-path variable as the
> inter-process flag for (2). Which feels a little funny, because its
> value is unrelated to the alt-odb setup. But it is a reliable
> signal, so
> there's a certain elegance. It's probably the best option, given that
> the alternative is a specific variable to say "hey, bump your
> max-alt-odb-depth by one". That's pretty ugly, too. :)
You took the words right out of my mouth... I guess I need to work
on doing a better job of dumping my stream-of-thoughts that go into a
patch into the emails to the list.
Most all of your comments could be dumped into the patch description
as-is to pimp it out some. I have no objection to that, even adding
an "Additional-analysis-by:" (or similar) credit line too. :)
--Kyle
^ permalink raw reply
* Re: git reset --hard should not irretrievably destroy new files
From: Christian Couder @ 2016-12-04 10:47 UTC (permalink / raw)
To: Julian de Bhal; +Cc: git
In-Reply-To: <CAJZCeG0p5UrqM4oSOJ1ALKqNG8SyYh8cexKaN9R6RYYzPsMfxQ@mail.gmail.com>
On Sun, Dec 4, 2016 at 1:57 AM, Julian de Bhal <julian.debhal@gmail.com> wrote:
> On Sat, Dec 3, 2016 at 6:11 PM, Christian Couder
> <christian.couder@gmail.com> wrote:
>> On Sat, Dec 3, 2016 at 6:04 AM, Julian de Bhal <julian.debhal@gmail.com> wrote:
>>> but I'd be nearly as happy if a
>>> commit was added to the reflog when the reset happens (I can probably make
>>> that happen with some configuration now that I've been bitten).
>>
>> Not sure if this has been proposed. Perhaps it would be simpler to
>> just output the sha1, and maybe the filenames too, of the blobs, that
>> are no more referenced from the trees, somewhere (in a bloblog?).
>
> Yeah, after doing a bit more reading around the issue, this seems like
> a smaller part of destroying local changes with a hard reset, and I'm
> one of the lucky ones where it is recoverable.
Yeah, but not everyone knows it is recoverable and using fsck to
recover is not nice and easy for the user.
So having a bloblog for example in .git/logs/blobs/, like the reflogs
we already have, but for blobs, could help even if (first) it's just
about writing the filenames and sha1s related to the blobs we stop
referencing.
> Has anyone discussed having `git reset --hard` create objects for the
> current state of anything it's about to destroy, specifically so they
> end up in the --lost-found?
Well, when we start talking about creating new objects, then someone
usually says that it is what "git stash" is about. So the discussion
then often turns to how can we make people more aware of "git stash",
or incite them to create an alias or a shell function that does a "git
stash" before "git reset --hard ...", or teach them to use "git reset
--keep ..." when it does what they want and is safer...
> I think this is what you're suggesting, only without checking for
> references, so that tree & blob objects exist that make any hard reset
> reversible.
I suggest we start with just logging blobs that we have already
created (when they have been "git add"ed) but that we are
dereferencing.
If we can agree on that, it will already help and not be very costly
performance wise. After that we could then start thinking about
creating blobs for all the content we discard, which could be done
only in a beginner mode (at least at first) to make sure it has no
performance impact if people rely on "git reset --hard" being fast.
^ permalink raw reply
* Re: Git v2.11.0 breaks max depth nested alternates
From: Philip Oakley @ 2016-12-04 11:22 UTC (permalink / raw)
To: Kyle J. McKay, Jeff King, Junio C Hamano; +Cc: Git mailing list
In-Reply-To: <fe33de5b5f0b3da68b249cc4a49a6d7@3c843fe6ba8f3c586a21345a2783aa0>
From: "Kyle J. McKay" <mackyle@gmail.com>
Sent: Sunday, December 04, 2016 12:24 AM
> The recent addition of pre-receive quarantining breaks nested
> alternates that are already at the maximum alternates nesting depth.
>
> In the file sha1_file.c in the function link_alt_odb_entries we have
> this:
>
> > if (depth > 5) {
> > error("%s: ignoring alternate object stores, nesting too deep.",
> > relative_base);
> > return;
> > }
>
> When the incoming quarantine takes place the current objects directory
> is demoted to an alternate thereby increasing its depth (and any
> alternates it references) by one and causing any object store that was
> previously at the maximum nesting depth to be ignored courtesy of the
> above hard-coded maximum depth.
>
> If the incoming push happens to need access to some of those objects
> to perhaps "--fix-thin" its pack it will crash and burn.
>
> Originally I was not going to include a patch to fix this, but simply
> suggest that the expeditious fix is to just allow one additional
> alternates nesting depth level during quarantine operations.
>
> However, it was so simple, I have included the patch below :)
>
> I have verified that where a push with Git v2.10.2 succeeds and a push
> with Git v2.11.0 to the same repository fails because of this problem
> that the below patch does indeed correct the issue and allow the push
> to succeed.
>
> Cheers,
>
> Kyle
>
> -- 8< --
> Subject: [PATCH] receive-pack: increase max alternates depth during
> quarantine
>
> Ever since 722ff7f876 (receive-pack: quarantine objects until
> pre-receive accepts, 2016-10-03, v2.11.0), Git has been quarantining
> objects and packs received during an incoming push into a separate
> objects directory and using the alternates mechanism to make them
> available until they are either accepted and moved into the main
> objects directory or rejected and discarded.
Is there a step here that after the accepted/rejected stage, it should then
decrement the limit back to its original value. The problem description
suggests that might be the case.
--
Philip
>
> Unfortunately this has the side effect of increasing the alternates
> nesting depth level by one for all pre-existing alternates.
>
> If a repository is already at the maximum alternates nesting depth,
> then this quarantining operation can temporarily push it over making
> the incoming push fail.
>
> To prevent the failure we simply increase the allowed alternates
> nesting depth by one whenever a quarantine operation is in effect.
>
> Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
> ---
>
> Notes:
> Some alternates nesting depth background:
>
> If base/fork0/fork1/fork2/fork3/fork4/fork5 represents
> seven git repositories where base.git has no alternates,
> fork0.git has base.git as an alternate, fork1.git has
> fork0.git as an alternate and so on where fork5.git has
> only fork4.git as an alternate, then fork5.git is at
> the maximum allowed depth of 5. git fsck --strict --full
> works without complaint on fork5.git.
>
> However, in base/fork0/fork1/fork2/fork3/fork4/fork5/fork6,
> an fsck --strict --full of fork6.git will generate complaints
> and any objects/packs present in base.git will be ignored.
>
> cache.h | 1 +
> common-main.c | 3 +++
> environment.c | 1 +
> sha1_file.c | 2 +-
> 4 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/cache.h b/cache.h
> index a50a61a1..25c17c29 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -676,6 +676,7 @@ extern size_t packed_git_limit;
> extern size_t delta_base_cache_limit;
> extern unsigned long big_file_threshold;
> extern unsigned long pack_size_limit_cfg;
> +extern int alt_odb_max_depth;
>
> /*
> * Accessors for the core.sharedrepository config which lazy-load the
> value
> diff --git a/common-main.c b/common-main.c
> index c654f955..9f747491 100644
> --- a/common-main.c
> +++ b/common-main.c
> @@ -37,5 +37,8 @@ int main(int argc, const char **argv)
>
> restore_sigpipe_to_default();
>
> + if (getenv(GIT_QUARANTINE_ENVIRONMENT))
> + alt_odb_max_depth++;
> +
> return cmd_main(argc, argv);
> }
> diff --git a/environment.c b/environment.c
> index 0935ec69..32e11f70 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -64,6 +64,7 @@ int merge_log_config = -1;
> int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
> unsigned long pack_size_limit_cfg;
> enum hide_dotfiles_type hide_dotfiles = HIDE_DOTFILES_DOTGITONLY;
> +int alt_odb_max_depth = 5;
>
> #ifndef PROTECT_HFS_DEFAULT
> #define PROTECT_HFS_DEFAULT 0
> diff --git a/sha1_file.c b/sha1_file.c
> index 9c86d192..15b8432e 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -337,7 +337,7 @@ static void link_alt_odb_entries(const char *alt, int
> len, int sep,
> int i;
> struct strbuf objdirbuf = STRBUF_INIT;
>
> - if (depth > 5) {
> + if (depth > alt_odb_max_depth) {
> error("%s: ignoring alternate object stores, nesting too deep.",
> relative_base);
> return;
> ---
>
^ permalink raw reply
* [PATCH v1] t0021: minor filter process test cleanup
From: larsxschneider @ 2016-12-04 13:37 UTC (permalink / raw)
To: git; +Cc: Lars Schneider
From: Lars Schneider <larsxschneider@gmail.com>
Remove superfluous .gitignore pattern and invalid '.' in `git commit`
calls.
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
Notes:
Base Commit: 454cb6b (v2.11.0)
Diff on Web: https://git.io/test_ls_filter-process_cleanup-test-v1.diff
Checkout: git fetch https://github.com/larsxschneider/git filter-process/cleanup-test-v1 && git checkout c052a3d
t/t0021-conversion.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 4ea534e9fa..34891c4b1a 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -350,10 +350,9 @@ test_expect_success PERL 'required process filter should filter data' '
cd repo &&
git init &&
- echo "git-stderr.log" >.gitignore &&
echo "*.r filter=protocol" >.gitattributes &&
git add . &&
- git commit . -m "test commit 1" &&
+ git commit -m "test commit 1" &&
git branch empty-branch &&
cp "$TEST_ROOT/test.o" test.r &&
@@ -378,7 +377,7 @@ test_expect_success PERL 'required process filter should filter data' '
EOF
test_cmp_count expected.log rot13-filter.log &&
- filter_git commit . -m "test commit 2" &&
+ filter_git commit -m "test commit 2" &&
cat >expected.log <<-EOF &&
START
init handshake complete
--
2.11.0
^ permalink raw reply related
* [PATCH v1] travis-ci: update P4 to 16.2 and GitLFS to 1.5.2 in Linux build
From: larsxschneider @ 2016-12-04 13:52 UTC (permalink / raw)
To: git; +Cc: Lars Schneider
From: Lars Schneider <larsxschneider@gmail.com>
Update Travis-CI dependencies to the latest available versions in
Linux build.
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
Notes:
Base Commit: 454cb6b (v2.11.0)
Diff on Web: https://git.io/test_ls_travisci_dep-update-v1.diff
Checkout: git fetch https://github.com/larsxschneider/git travisci/dep-update-v1 && git checkout 421365c
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 0b2ea5c3e2..3843967a69 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,8 +27,8 @@ env:
# The Linux build installs the defined dependency versions below.
# The OS X build installs the latest available versions. Keep that
# in mind when you encounter a broken OS X build!
- - LINUX_P4_VERSION="16.1"
- - LINUX_GIT_LFS_VERSION="1.2.0"
+ - LINUX_P4_VERSION="16.2"
+ - LINUX_GIT_LFS_VERSION="1.5.2"
- DEFAULT_TEST_TARGET=prove
- GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
- GIT_TEST_OPTS="--verbose-log"
--
2.11.0
^ permalink raw reply related
* [PATCH v1] git-p4: add config to retry p4 commands; retry 3 times by default
From: larsxschneider @ 2016-12-04 14:03 UTC (permalink / raw)
To: git; +Cc: luke, orirawlings, Lars Schneider, Lars Schneider
From: Lars Schneider <lars.schneider@autodesk.com>
P4 commands can fail due to random network issues. P4 users can counter
these issues by using a retry flag supported by all p4 commands [1].
Add an integer Git config value `git-p4.retries` to define the number of
retries for all p4 invocations. If the config is not defined then set
the default retry count to 3.
[1] https://www.perforce.com/perforce/doc.current/manuals/cmdref/global.options.html
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
Notes:
Base Commit: 454cb6b (v2.11.0)
Diff on Web: https://github.com/git/git/compare/454cb6b...larsxschneider:654c727
Checkout: git fetch https://github.com/larsxschneider/git git-p4/retries-v1 && git checkout 654c727
Documentation/git-p4.txt | 4 ++++
git-p4.py | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
index c83aaf39c3..656587248c 100644
--- a/Documentation/git-p4.txt
+++ b/Documentation/git-p4.txt
@@ -467,6 +467,10 @@ git-p4.client::
Client specified as an option to all p4 commands, with
'-c <client>', including the client spec.
+git-p4.retries::
+ Specifies the number of times to retry a p4 command (notably,
+ 'p4 sync') if the network times out. The default value is 3.
+
Clone and sync variables
~~~~~~~~~~~~~~~~~~~~~~~~
git-p4.syncFromOrigin::
diff --git a/git-p4.py b/git-p4.py
index fd5ca52462..2422178210 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -78,6 +78,11 @@ def p4_build_cmd(cmd):
if len(client) > 0:
real_cmd += ["-c", client]
+ retries = gitConfigInt("git-p4.retries")
+ if retries is None:
+ # Perform 3 retries by default
+ retries = 3
+ real_cmd += ["-r", str(retries)]
if isinstance(cmd,basestring):
real_cmd = ' '.join(real_cmd) + ' ' + cmd
--
2.11.0
^ permalink raw reply related
* [PATCH] Completion: Add support for --submodule=diff
From: peterjclaw @ 2016-12-04 14:41 UTC (permalink / raw)
To: git; +Cc: jacob.keller, gitster, szeder, Peter Law
From: Peter Law <PeterJCLaw@gmail.com>
Teach git-completion.bash about the 'diff' option to 'git diff
--submodule=', which was added in Git 2.11.
Signed-off-by: Peter Law <PeterJCLaw@gmail.com>
---
contrib/completion/git-completion.bash | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 21016bf8d..ab11e7371 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1206,7 +1206,7 @@ _git_describe ()
__git_diff_algorithms="myers minimal patience histogram"
-__git_diff_submodule_formats="log short"
+__git_diff_submodule_formats="diff log short"
__git_diff_common_options="--stat --numstat --shortstat --summary
--patch-with-stat --name-only --name-status --color
--
2.11.0
^ permalink raw reply related
* [PATCH v1] git-p4: fix empty file processing for large file system backend GitLFS
From: larsxschneider @ 2016-12-04 16:03 UTC (permalink / raw)
To: git; +Cc: luke, Lars Schneider, Lars Schneider
From: Lars Schneider <lars.schneider@autodesk.com>
If git-p4 tried to store an empty file in GitLFS then it crashed while
parsing the pointer file:
oid = re.search(r'^oid \w+:(\w+)', pointerFile, re.MULTILINE).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
This happens because GitLFS does not create a pointer file for an empty
file. Teach git-p4 this behavior to fix the problem and add a test case.
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
Notes:
Base Commit: 454cb6b (v2.11.0)
Diff on Web: https://github.com/git/git/compare/454cb6b...larsxschneider:b717fde
Checkout: git fetch https://github.com/larsxschneider/git git-p4/empty-files-v1 && git checkout b717fde
git-p4.py | 29 +++++++++++++++++------------
t/t9824-git-p4-git-lfs.sh | 2 ++
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index fd5ca52462..ccfb68105f 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1005,18 +1005,20 @@ class LargeFileSystem(object):
steps."""
if self.exceedsLargeFileThreshold(relPath, contents) or self.hasLargeFileExtension(relPath):
contentTempFile = self.generateTempFile(contents)
- (git_mode, contents, localLargeFile) = self.generatePointer(contentTempFile)
-
- # Move temp file to final location in large file system
- largeFileDir = os.path.dirname(localLargeFile)
- if not os.path.isdir(largeFileDir):
- os.makedirs(largeFileDir)
- shutil.move(contentTempFile, localLargeFile)
- self.addLargeFile(relPath)
- if gitConfigBool('git-p4.largeFilePush'):
- self.pushFile(localLargeFile)
- if verbose:
- sys.stderr.write("%s moved to large file system (%s)\n" % (relPath, localLargeFile))
+ (pointer_git_mode, contents, localLargeFile) = self.generatePointer(contentTempFile)
+ if pointer_git_mode:
+ git_mode = pointer_git_mode
+ if localLargeFile:
+ # Move temp file to final location in large file system
+ largeFileDir = os.path.dirname(localLargeFile)
+ if not os.path.isdir(largeFileDir):
+ os.makedirs(largeFileDir)
+ shutil.move(contentTempFile, localLargeFile)
+ self.addLargeFile(relPath)
+ if gitConfigBool('git-p4.largeFilePush'):
+ self.pushFile(localLargeFile)
+ if verbose:
+ sys.stderr.write("%s moved to large file system (%s)\n" % (relPath, localLargeFile))
return (git_mode, contents)
class MockLFS(LargeFileSystem):
@@ -1056,6 +1058,9 @@ class GitLFS(LargeFileSystem):
the actual content. Return also the new location of the actual
content.
"""
+ if os.path.getsize(contentFile) == 0:
+ return (None, '', None)
+
pointerProcess = subprocess.Popen(
['git', 'lfs', 'pointer', '--file=' + contentFile],
stdout=subprocess.PIPE
diff --git a/t/t9824-git-p4-git-lfs.sh b/t/t9824-git-p4-git-lfs.sh
index 110a7e7924..734b8db4cb 100755
--- a/t/t9824-git-p4-git-lfs.sh
+++ b/t/t9824-git-p4-git-lfs.sh
@@ -42,6 +42,8 @@ test_expect_success 'Create repo with binary files' '
(
cd "$cli" &&
+ >file0.dat &&
+ p4 add file0.dat &&
echo "content 1 txt 23 bytes" >file1.txt &&
p4 add file1.txt &&
echo "content 2-3 bin 25 bytes" >file2.dat &&
--
2.11.0
^ permalink raw reply related
* [BUG] git gui can't commit multiple files
From: Timon @ 2016-12-04 16:36 UTC (permalink / raw)
To: git
This is a regression in git 2.11.0 (version 2.10.2 is fine).
In git-gui I select multiple files in the Unstaged Changes (using
shift+click) and press ctrl+t to stage them. Then only one files gets
staged instead of all of the selected files.
The same happens when unstaging files.
Git-cola also exhibits the same behavior. Although there I could stage
multiple files if I used a popup menu instead of the keyboard shortcut
(I'm guessing it goes through a different code path?).
Note that I tested by reverting back to 2.10.2 and verified that
everything works, so I'm quite certain that this is a regression in
git.
^ permalink raw reply
* Re: git reset --hard should not irretrievably destroy new files
From: Junio C Hamano @ 2016-12-04 19:08 UTC (permalink / raw)
To: Julian de Bhal; +Cc: git
In-Reply-To: <CAJZCeG1Eu+5DfaxavX_WGUCa+SY+yepDWZhPXxiFcV__h0xjrw@mail.gmail.com>
Julian de Bhal <julian.debhal@gmail.com> writes:
> The behaviour that would make the most sense to me (personally) would be
> for a hard reset to unstage new files,...
I think _sometimes_ that may be useful. I haven't thought things
through yet to arrive the final decision, but one thing that must be
kept in mind by anybody who wants to move this topic forward is that
a path that does not exist in the HEAD commit MUST be removed from
the index and the working tree upon "git reset --hard" when the path
resulted from a mergy operation. I.e. in this sequence:
$ git merge other-branch ;# or git cherry-pick one-commit
... try to resolve conflicts, make a mess, decide
... to try it again from scratch
$ git reset --hard
$ git merge other-branch ;# or git cherry-pick one-commit
the "reset --hard" step MUST remove new paths that existed only on
the other-branch (or in one-commit), which by definition would have
auto-resolved cleanly, from the index and the working tree. There
are other commands (e.g. "git am -3", "git apply -3", "git rebase")
that are "mergy" and their intermediate states must be handled the
same way.
If a very simple to explain and understand rule can be used to tell
if a new path (i.e. a path that exists in the index and in the
working tree, but is not in the HEAD commit) is what was created
manually by the end user without any other copy (i.e. "create
newfile && edit newfile && git add newfile") and is not a result of
a mergy operation being abandoned, then I think it is OK to allow
"reset --hard" to leave the working tree files untracked, but if the
rule becomes anything complex to understand for the users, I think
it would make the behaviour of "reset --hard" hard to explain,
understand AND anticipate---and at that point, we would be better
off keeping the "You said 'hard', we clean 'hard' to match HEAD"
behaviour of "reset --hard" and EDUCATE users not to say 'hard' too
casually. There may be a room for new option that unconditionally
leave the new working tree files untracked so that users can choose
between the two, if we end up going that route.
^ permalink raw reply
* [PATCH] diff: fix up SHA-1 abbreviations outside of repository
From: Jack Bates @ 2016-12-04 19:47 UTC (permalink / raw)
To: git; +Cc: Jeff King, Jack Bates
The three cases where "git diff" operates outside of a repository are 1)
when we run it outside of a repository, 2) when one of the files we're
comparing is outside of the repository we're in, and 3) the --no-index
option. Commit 4f03666 ("diff: handle sha1 abbreviations outside of
repository", 2016-10-20) only worked in the first case.
---
builtin/diff.c | 4 +++-
t/t4063-diff-no-index-abbrev.sh | 50 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
create mode 100755 t/t4063-diff-no-index-abbrev.sh
diff --git a/builtin/diff.c b/builtin/diff.c
index 7f91f6d..ec7c432 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -342,9 +342,11 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
"--no-index" : "[--no-index]");
}
- if (no_index)
+ if (no_index) {
/* If this is a no-index diff, just run it and exit there. */
+ startup_info->have_repository = 0;
diff_no_index(&rev, argc, argv);
+ }
/* Otherwise, we are doing the usual "git" diff */
rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;
diff --git a/t/t4063-diff-no-index-abbrev.sh b/t/t4063-diff-no-index-abbrev.sh
new file mode 100755
index 0000000..d1d6302
--- /dev/null
+++ b/t/t4063-diff-no-index-abbrev.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+test_description='don'\'' peek into .git when operating outside of a repository
+
+When abbreviating SHA-1s, if another object in the repository has the
+same abbreviation, we normally lengthen the abbreviation until it'\''s
+unique. Commit 4f03666 ("diff: handle sha1 abbreviations outside of
+repository", 2016-10-20) addressed the case of abbreviating SHA-1s
+outside the context of a repository. In that case we shouldn'\''t peek
+into a .git directory to make an abbreviation unique.
+
+To check that we don'\''t, create an blob with a SHA-1 that starts with
+0000. (Outside of a repository, SHA-1s are all zeros.) Then make an
+abbreviation and check that Git doesn'\''t lengthen it.
+
+The three cases where "git diff" operates outside of a repository are
+1) when we run it outside of a repository, 2) when one of the files
+we'\''re comparing is outside of the repository we'\''re in,
+and 3) the --no-index option.
+'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo 1 >a &&
+ echo 2 >b &&
+ git init repo &&
+ (
+ cd repo &&
+
+ # Create a blob
+ # 00002e907f44c3881822c473d8842405cfd96362
+ echo 119132 >collision &&
+ git add collision
+ )
+'
+
+cat >expect <<EOF
+:100644 100644 0000... 0000... M ../a
+EOF
+
+test_expect_success 'don'\''t peek into .git when operating outside of a repository' '
+ (
+ cd repo &&
+ test_must_fail git diff --raw --abbrev=4 ../a ../b >actual &&
+ test_cmp ../expect actual
+ )
+'
+
+test_done
--
2.10.2
^ permalink raw reply related
* Re: [BUG] git gui can't commit multiple files
From: David Aguilar @ 2016-12-04 20:40 UTC (permalink / raw)
To: Timon; +Cc: git
In-Reply-To: <CANtxn9J9O+PADxpWa0JCcgwwk_tC5DuJGUruULN2fGP3knZ-Sw@mail.gmail.com>
On Sun, Dec 04, 2016 at 05:36:46PM +0100, Timon wrote:
> This is a regression in git 2.11.0 (version 2.10.2 is fine).
>
> In git-gui I select multiple files in the Unstaged Changes (using
> shift+click) and press ctrl+t to stage them. Then only one files gets
> staged instead of all of the selected files.
> The same happens when unstaging files.
>
> Git-cola also exhibits the same behavior. Although there I could stage
> multiple files if I used a popup menu instead of the keyboard shortcut
> (I'm guessing it goes through a different code path?).
Can you elaborate a bit?
I just tested git-cola with Git 2.11 and it worked fine for me.
I selected several files and used the Ctrl+s hotkey to stage the
selected files. They all got staged.
If you have a test repo, or reproduction recipe, I'd be curious
to try it out.
--
David
^ permalink raw reply
* [RFC PATCH] GIT-VERSION-GEN: set --abbrev=9 to match auto-scaling
From: Ramsay Jones @ 2016-12-04 20:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT Mailing-list
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Junio,
I recently noticed that:
$ make >pout 2>&1
$ ./git version
git version 2.11.0.286.g109e8a9
$ git describe
v2.11.0-286-g109e8a99d
$
... for non-release builds, the commit part of the version
string was still using an --abbrev=7.
I don't know that it actually matters too much (since it will
show as many as necessary, thus the RFC), but it caused me to
look twice. ;-)
ATB,
Ramsay Jones
GIT-VERSION-GEN | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 520d6e66e..05601f753 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -12,7 +12,7 @@ if test -f version
then
VN=$(cat version) || VN="$DEF_VER"
elif test -d ${GIT_DIR:-.git} -o -f .git &&
- VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
+ VN=$(git describe --match "v[0-9]*" --abbrev=9 HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
--
2.11.0
^ permalink raw reply related
* [PATCH] bisect: improve English grammar of not-ancestors message
From: Alex Henrie @ 2016-12-04 22:04 UTC (permalink / raw)
To: pclouds, gitster, git; +Cc: Alex Henrie
Multiple revisions cannot be a single ancestor.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
bisect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bisect.c b/bisect.c
index 21bc6da..8e63c40 100644
--- a/bisect.c
+++ b/bisect.c
@@ -747,7 +747,7 @@ static void handle_bad_merge_base(void)
exit(3);
}
- fprintf(stderr, _("Some %s revs are not ancestor of the %s rev.\n"
+ fprintf(stderr, _("Some %s revs are not ancestors of the %s rev.\n"
"git bisect cannot work properly in this case.\n"
"Maybe you mistook %s and %s revs?\n"),
term_good, term_bad, term_good, term_bad);
--
2.10.2
^ permalink raw reply related
* [PATCH] receive-pack: improve English grammar of denyCurrentBranch message
From: Alex Henrie @ 2016-12-04 22:04 UTC (permalink / raw)
To: gitster, git; +Cc: Alex Henrie
The article "the" is required here.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
builtin/receive-pack.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e6b3879..6b97cbd 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -795,8 +795,8 @@ static char *refuse_unconfigured_deny_msg =
"with what you pushed, and will require 'git reset --hard' to match\n"
"the work tree to HEAD.\n"
"\n"
- "You can set 'receive.denyCurrentBranch' configuration variable to\n"
- "'ignore' or 'warn' in the remote repository to allow pushing into\n"
+ "You can set the 'receive.denyCurrentBranch' configuration variable\n"
+ "to 'ignore' or 'warn' in the remote repository to allow pushing into\n"
"its current branch; however, this is not recommended unless you\n"
"arranged to update its work tree to match what you pushed in some\n"
"other way.\n"
--
2.10.2
^ permalink raw reply related
* [PATCH] clone,fetch: explain the shallow-clone option a little more clearly
From: Alex Henrie @ 2016-12-04 22:03 UTC (permalink / raw)
To: pclouds, gitster, git; +Cc: Alex Henrie
"deepen by excluding" does not make sense because excluding a revision
does not deepen a repository; it makes the repository more shallow.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
builtin/clone.c | 2 +-
builtin/fetch.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index 6c76a6e..e3cb808 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -99,7 +99,7 @@ static struct option builtin_clone_options[] = {
OPT_STRING(0, "shallow-since", &option_since, N_("time"),
N_("create a shallow clone since a specific time")),
OPT_STRING_LIST(0, "shallow-exclude", &option_not, N_("revision"),
- N_("deepen history of shallow clone by excluding rev")),
+ N_("deepen history of shallow clone, excluding rev")),
OPT_BOOL(0, "single-branch", &option_single_branch,
N_("clone only one branch, HEAD or --branch")),
OPT_BOOL(0, "shallow-submodules", &option_shallow_submodules,
diff --git a/builtin/fetch.c b/builtin/fetch.c
index b6a5597..fc74c84 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -122,7 +122,7 @@ static struct option builtin_fetch_options[] = {
OPT_STRING(0, "shallow-since", &deepen_since, N_("time"),
N_("deepen history of shallow repository based on time")),
OPT_STRING_LIST(0, "shallow-exclude", &deepen_not, N_("revision"),
- N_("deepen history of shallow clone by excluding rev")),
+ N_("deepen history of shallow clone, excluding rev")),
OPT_INTEGER(0, "deepen", &deepen_relative,
N_("deepen history of shallow clone")),
{ OPTION_SET_INT, 0, "unshallow", &unshallow, NULL,
--
2.10.2
^ permalink raw reply related
* Re: difftool -d not populating left correctly when not in git root
From: David Aguilar @ 2016-12-04 22:31 UTC (permalink / raw)
To: Frank Becker; +Cc: git, John Keeping, Johannes Schindelin, Junio C Hamano
In-Reply-To: <68f49f5e-4e71-fd52-cd6f-64e92face962@mooflu.com>
On Fri, Dec 02, 2016 at 03:04:01PM -0800, Frank Becker wrote:
> Hi,
>
> looks like this broke between 2.9.2 and 2.9.3
>
> cat ~/.gitconfig
> [difftool "diff"]
> cmd = ls -l ${LOCAL}/* ${REMOTE}/*
> #cmd = diff -r ${LOCAL} ${REMOTE} | less
>
> ~/stuff/gittest> ls -l *
> d1:
> total 8
> -rw-r--r-- 1 frank staff 16 2 Dec 14:30 test.txt
>
> d2:
> total 8
> -rw-r--r-- 1 frank staff 18 2 Dec 14:30 anothertest.tst
>
>
> ~/stuff/gittest> git status
> On branch master
> Changes not staged for commit:
> (use "git add <file>..." to update what will be committed)
> (use "git checkout -- <file>..." to discard changes in working directory)
>
> modified: d1/test.txt
> modified: d2/anothertest.tst
>
>
> ~/stuff/gittest> ~/stuff/git_tmp/bin/git --version
> git version 2.11.0
>
> ~/stuff/gittest> ~/stuff/git_tmp/bin/git difftool -d -t diff
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.0oGRF/left/d1:
> total 8
> -rw-r--r-- 1 frank staff 6 2 Dec 14:52 test.txt
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.0oGRF/left/d2:
> total 8
> -rw-r--r-- 1 frank staff 7 2 Dec 14:52 anothertest.tst
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.0oGRF/right/d1:
> total 8
> lrwxr-xr-x 1 frank staff 38 2 Dec 14:52 test.txt ->
> /Users/frank/stuff/gittest/d1/test.txt
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.0oGRF/right/d2:
> total 8
> lrwxr-xr-x 1 frank staff 45 2 Dec 14:52 anothertest.tst ->
> /Users/frank/stuff/gittest/d2/anothertest.tst
>
>
> cd d2
> ~/stuff/gittest/d2> ~/stuff/git_tmp/bin/git difftool -d -t diff
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.eRXhB/left/d2:
> total 8
> -rw-r--r-- 1 frank staff 7 2 Dec 14:52 anothertest.tst
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.eRXhB/right/d1:
> total 8
> lrwxr-xr-x 1 frank staff 38 2 Dec 14:52 test.txt ->
> /Users/frank/stuff/gittest/d1/test.txt
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.eRXhB/right/d2:
> total 8
> lrwxr-xr-x 1 frank staff 45 2 Dec 14:52 anothertest.tst ->
> /Users/frank/stuff/gittest/d2/anothertest.tst
>
>
> Note that left does not contain d1
>
>
>
> ~/stuff/gittest/d2> ~/stuff/git_tmp/bin/git --version
> git version 2.9.2
> ~/stuff/gittest/d2> ~/stuff/git_tmp/bin/git difftool -d -t diff
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.YxtVw/left/d1:
> total 8
> -rw-r--r-- 1 frank staff 6 2 Dec 15:02 test.txt
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.YxtVw/left/d2:
> total 8
> -rw-r--r-- 1 frank staff 7 2 Dec 15:02 anothertest.tst
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.YxtVw/right/d1:
> total 8
> lrwxr-xr-x 1 frank staff 38 2 Dec 15:02 test.txt ->
> /Users/frank/stuff/gittest/d1/test.txt
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.YxtVw/right/d2:
> total 8
> lrwxr-xr-x 1 frank staff 45 2 Dec 15:02 anothertest.tst ->
> /Users/frank/stuff/gittest/d2/anothertest.tst
>
>
>
> ~/stuff/gittest/d2> ~/stuff/git_tmp/bin/git --version
> git version 2.9.3
> ~/stuff/gittest/d2> ~/stuff/git_tmp/bin/git difftool -d -t diff
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.TpJ5u/left/d2:
> total 8
> -rw-r--r-- 1 frank staff 7 2 Dec 15:01 anothertest.tst
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.TpJ5u/right/d1:
> total 8
> lrwxr-xr-x 1 frank staff 38 2 Dec 15:01 test.txt ->
> /Users/frank/stuff/gittest/d1/test.txt
>
> /var/folders/0j/3pk3pdsx7rzb9_njdpyjwm000000gn/T/git-difftool.TpJ5u/right/d2:
> total 8
> lrwxr-xr-x 1 frank staff 45 2 Dec 15:01 anothertest.tst ->
> /Users/frank/stuff/gittest/d2/anothertest.tst
This regression was not caught by our test suite.
This looks like it's an edge case not handled by:
9ec26e797781 "difftool: fix argument handling in subdirs"
The current "rewrite difftool in C" topic may need a
similar adjustment.
The problem:
When preparing the right-side of the diff we only construct the
parts that changed. When constructing the left side we
construct a full index, but we were constructing it relative to
the subdirectory, and thus it ends up empty because we are in a
subdirectory and the paths are incorrect.
The fix seems simple -- when preparing the index files we need
to chdir to the toplevel to ensure that the index construction
steps find the correct toplevel-relative paths.
Thanks for the heads-up,
David
--- 8< ---
Date: Sun, 4 Dec 2016 14:27:17 -0800
Subject: [PATCH] difftool: properly handle being launched from a subdirectory
9ec26e797781239b36ebccb87c590e5778358007 corrected how path arguments
are handled in a subdirectory, but it introduced a regression in how
entries outside of the subdirectory are handled by the dir-diff.
When preparing the right-side of the diff we only construct the parts
that changed.
When constructing the left side we construct an index, but we were
constructing it relative to the subdirectory, and thus it ends up empty
because we are in a subdirectory and the paths are incorrect.
Teach difftool to chdir to the toplevel of the repository before
preparing its temporary indexes. This ensures that all of the
toplevel-relative paths are valid.
Add a test case to exercise this use case.
Reported-by: Frank Becker <fb@mooflu.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
git-difftool.perl | 4 ++++
t/t7800-difftool.sh | 7 +++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/git-difftool.perl b/git-difftool.perl
index a5790d03a..959822d5f 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -182,6 +182,10 @@ EOF
}
}
+ # Go to the root of the worktree so that the left index files
+ # are properly setup -- the index is toplevel-relative.
+ chdir($workdir);
+
# Setup temp directories
my $tmpdir = tempdir('git-difftool.XXXXX', CLEANUP => 0, TMPDIR => 1);
my $ldir = "$tmpdir/left";
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 70a2de461..caab4b5ca 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -413,8 +413,11 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory' '
(
cd sub &&
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
- grep sub output &&
- grep file output
+ # "sub" must only exist in "right"
+ # "file" and "file2" must be listed in both "left" and "right"
+ test "1" = $(grep sub output | wc -l) &&
+ test "2" = $(grep file"$" output | wc -l) &&
+ test "2" = $(grep file2 output | wc -l)
)
'
--
2.11.0.dirty
^ permalink raw reply related
* Should reset_revision_walk clear more flags?
From: Mike Hommey @ 2016-12-04 23:09 UTC (permalink / raw)
To: git
Hi,
While trying to use the revision walking API twice in a row, I noticed
that the second time for the same setup would not yield the same result.
In my case, it turns out I was requesting boundaries, and
reset_revision_walk() is not resetting CHILD_SHOWN and BOUNDARY, both
required to be reset for the second revision walk to work.
So the question is, are consumers supposed to reset those flags on their
own, or should reset_revision_walk clear them?
Mike
^ permalink raw reply
* Re: Should reset_revision_walk clear more flags?
From: Mike Hommey @ 2016-12-04 23:24 UTC (permalink / raw)
To: git
In-Reply-To: <20161204230958.h3ilhueqqptv253u@glandium.org>
On Mon, Dec 05, 2016 at 08:09:58AM +0900, Mike Hommey wrote:
> Hi,
>
> While trying to use the revision walking API twice in a row, I noticed
> that the second time for the same setup would not yield the same result.
> In my case, it turns out I was requesting boundaries, and
> reset_revision_walk() is not resetting CHILD_SHOWN and BOUNDARY, both
> required to be reset for the second revision walk to work.
and TREESAME when using different pathspecs.
Mike
^ permalink raw reply
* Re: Where is Doc to configure Git + Apache + kerberos for Project level access in repo?
From: brian m. carlson @ 2016-12-05 2:31 UTC (permalink / raw)
To: Jeff King; +Cc: ken edward, git
In-Reply-To: <20161202222153.3j5i5rsacybwexg6@sigill.intra.peff.net>
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]
On Fri, Dec 02, 2016 at 05:21:53PM -0500, Jeff King wrote:
> On Fri, Dec 02, 2016 at 01:15:02PM -0500, ken edward wrote:
>
> > Where is Doc to configure Git + Apache + kerberos for Project level
> > access in repo?
>
> I don't know about Kerberos, but all of the documentation in git for
> configuring Apache is found in "git help http-backend".
If you want to use Kerberos for authentication, it's really as simple as
just using "AuthType Kerberos" instead of "AuthType Basic", plus
whatever Kerberos parameters you want.
This is what my configuration looks like, but obviously you'll want to
modify it a bit:
AuthType Kerberos
AuthName "Kerberos Login"
KrbMethodNegotiate on
KrbMethodK5Passwd off
KrbAuthRealms CRUSTYTOOTHPASTE.NET
Krb5Keytab /etc/krb5.apache.keytab
You may also want to set http.emptyAuth on the client side.
--
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]
^ permalink raw reply
* Re: Error after calling git difftool -d with
From: David Aguilar @ 2016-12-05 5:15 UTC (permalink / raw)
To: P. Duijst; +Cc: Johannes Schindelin, git
In-Reply-To: <alpine.DEB.2.20.1612021704170.117539@virtualbox>
On Fri, Dec 02, 2016 at 05:05:06PM +0100, Johannes Schindelin wrote:
> Hi Peter,
>
> On Fri, 2 Dec 2016, P. Duijst wrote:
>
> > Incase filenames are used with a quote ' or a bracket [ (and maybe some more
> > characters), git "diff" and "difftool -y" works fine, but git *difftool **-d*
> > gives the next error message:
> >
> > peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > $ git diff
> > diff --git a/Test ''inch.txt b/Test ''inch.txt
> > index dbff793..41f3257 100644
> > --- a/Test ''inch.txt
> > +++ b/Test ''inch.txt
> > @@ -1 +1,3 @@
> > +
> > +ddd
> > Test error in simple repository
> > warning: LF will be replaced by CRLF in Test ''inch.txt.
> > The file will have its original line endings in your working directory.
> >
> > peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > *$ git difftool -d*
> > *fatal: Cannot open '/d/Dev/test//Test ''inch.txt': No such file or
> > directory*
> > *hash-object /d/Dev/test//Test ''inch.txt: command returned error: 128*
> >
> > peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > $
> >
> >
> > This issue is inside V2.10.x and V2.11.0.
> > V2.9.0 is working correctly...
>
> You say v2.11.0, but did you also try the new, experimental builtin
> difftool? You can test without reinstalling:
>
> git -c difftool.useBuiltin=true difftool -d ...
FWIW, I verified that this problem does not manifest itself on
Linux, using the current scripted difftool.
Peter, what actual diff tool are you using?
Since these filenames work fine with "difftool -d" on Linux, it
suggests that this is either a tool-specific issue, or an issue
related to unix-to-windows path translation.
--
David
^ permalink raw reply
* Re: [RFC PATCH] GIT-VERSION-GEN: set --abbrev=9 to match auto-scaling
From: Jeff King @ 2016-12-05 5:32 UTC (permalink / raw)
To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list
In-Reply-To: <22e9dfa0-47fb-d6fd-caf4-c2d87f63f707@ramsayjones.plus.com>
On Sun, Dec 04, 2016 at 08:45:59PM +0000, Ramsay Jones wrote:
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Junio,
>
> I recently noticed that:
>
> $ make >pout 2>&1
> $ ./git version
> git version 2.11.0.286.g109e8a9
> $ git describe
> v2.11.0-286-g109e8a99d
> $
>
> ... for non-release builds, the commit part of the version
> string was still using an --abbrev=7.
It seems like this kind of discussion ought to go in the commit message.
:)
That said, I think the right patch may be to just drop --abbrev
entirely. Its use goes all the way back to 9b88fcef7 (Makefile: use
git-describe to mark the git version., 2005-12-27), where it was
--abbrev=4. That became --abbrev=7 in bf505158d (Git 1.7.10.1,
2012-05-01) without further comment.
I think at that point it was a noop, as 7 should have been the default.
And now we probably ought to drop it, so that we can use the
auto-scaling default.
-Peff
^ permalink raw reply
* Re: Should reset_revision_walk clear more flags?
From: Jeff King @ 2016-12-05 5:40 UTC (permalink / raw)
To: Mike Hommey; +Cc: git
In-Reply-To: <20161204230958.h3ilhueqqptv253u@glandium.org>
On Mon, Dec 05, 2016 at 08:09:58AM +0900, Mike Hommey wrote:
> While trying to use the revision walking API twice in a row, I noticed
> that the second time for the same setup would not yield the same result.
> In my case, it turns out I was requesting boundaries, and
> reset_revision_walk() is not resetting CHILD_SHOWN and BOUNDARY, both
> required to be reset for the second revision walk to work.
>
> So the question is, are consumers supposed to reset those flags on their
> own, or should reset_revision_walk clear them?
I would think that reset_revision_walk() should reset any flags set by
the revision-walking code (so anything set by calling init_revisions(),
and then either a call into list_objects() or repeated calls of
get_revision()).
Which I think would include both of the flags you mentioned, along with
others like SYMMETRIC_LEFT, PATCHSAME, etc. Probably really everything
mentioned in revision.h, which should be summed up as ALL_REV_FLAGS.
Some callsites already seem to feed that to clear_commit_marks().
I doubt you can go too wrong by clearing more flags. It's possible that
some caller is relying on a flag _not_ being cleared between two
traversals, but in that case it should probably be using
clear_commit_marks() or clear_object_flags() explicitly to make it clear
what it expects to be saved.
-Peff
^ permalink raw reply
* Re: [PATCH v2] diff: handle --no-abbrev outside of repository
From: Jeff King @ 2016-12-05 6:01 UTC (permalink / raw)
To: Jack Bates; +Cc: git, Junio C Hamano, Jack Bates
In-Reply-To: <20161202184840.2158-1-jack@nottheoilrig.com>
On Fri, Dec 02, 2016 at 11:48:40AM -0700, Jack Bates wrote:
> The "git diff --no-index" codepath didn't handle the --no-abbrev option.
> Also it didn't behave the same as find_unique_abbrev()
> in the case where abbrev == 0.
> find_unique_abbrev() returns the full, unabbreviated string in that
> case, but the "git diff --no-index" codepath returned an empty string.
If you've dug into what's wrong, I think it's often good to add some
notes in the commit message in case somebody has to revisit this later.
For example, I'd have written something like:
The "git diff --no-index" codepath doesn't handle the --no-abbrev
option, because it relies on diff_opt_parse(). Normally that function
is called as part of handle_revision_opt(), which handles the abbrev
options itself. Adding the option directly to diff_opt_parse() fixes
this. We don't need to do the same for --abbrev, because it's already
handled there.
Note that setting abbrev to "0" outside of a repository was broken
recently by 4f03666ac (diff: handle sha1 abbreviations outside of
repository, 2016-10-20). It adds a special out-of-repo code path for
handling abbreviations which behaves differently than find_unique_abbrev()
by truly giving a zero-length sha1, rather than taking "0" to mean "do
not abbreviate".
That bug was not triggerable until now, because there was no way to
set the value to zero (using --abbrev=0 silently bumps it to the
MINIMUM_ABBREV).
> t/t4013-diff-various.sh | 7 +++++++
> t/t4013/diff.diff_--no-index_--raw_--abbrev=4_dir2_dir | 3 +++
> t/t4013/diff.diff_--no-index_--raw_--no-abbrev_dir2_dir | 3 +++
> t/t4013/diff.diff_--no-index_--raw_dir2_dir | 3 +++
> t/t4013/diff.diff_--raw_--abbrev=4_initial | 6 ++++++
> t/t4013/diff.diff_--raw_--no-abbrev_initial | 6 ++++++
> t/t4013/diff.diff_--raw_initial | 6 ++++++
I wondered if the tests without --no-index were redundant with earlier
ones, but I don't think so. --abbrev=4 is tested with diff-tree, but
--no-abbrev is not covered at all, AFAICT.
> diff.c | 6 +++++-
The actual code changes look good to me.
Thanks.
-Peff
^ permalink raw reply
* Re: [PATCH v2] diff: handle --no-abbrev outside of repository
From: Jeff King @ 2016-12-05 6:15 UTC (permalink / raw)
To: Jack Bates; +Cc: git, Junio C Hamano, Jack Bates
In-Reply-To: <20161205060116.szy5ojetg3znu4w7@sigill.intra.peff.net>
On Mon, Dec 05, 2016 at 01:01:16AM -0500, Jeff King wrote:
> Note that setting abbrev to "0" outside of a repository was broken
> recently by 4f03666ac (diff: handle sha1 abbreviations outside of
> repository, 2016-10-20). It adds a special out-of-repo code path for
> handling abbreviations which behaves differently than find_unique_abbrev()
> by truly giving a zero-length sha1, rather than taking "0" to mean "do
> not abbreviate".
>
> That bug was not triggerable until now, because there was no way to
> set the value to zero (using --abbrev=0 silently bumps it to the
> MINIMUM_ABBREV).
Actually, I take this last paragraph back. You _can_ trigger the bug
with just:
echo one >foo
echo two >bar
git diff --no-index --raw foo bar
which prints only "..." for each entry.
I didn't notice it before because without "--raw", we show the patch
format. That uses the --full-index option, and does not respect --abbrev
at all (which seems kind of bizarre, but has been that way forever).
So I think there _is_ a regression in v2.11, and the second half of your
change fixes it.
-Peff
^ 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