Re: [PATCH 0/4] Good bye fnmatch
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: Long story short, we wanted globbing wildcard ** so I ripped wildmatch library from rsync to do it. Since version 3.0.0, rsync is GPLv3 URL:https://rsync.samba.org/GPL.html. So be sure to take an older version. And it opened a possibility to replace fnmatch completely, which would provide consistent behavior across platforms (native fnmatch behaves differently on many corner cases), and some performance gains. I started fnmatch replacement with 4917e1e (Makefile: promote wildmatch to be the default fnmatch implementation - 2013-05-30). This is the final step. Sounds like I'm, uh, somewhat late in the game. More likely than not you've taken care of that aspect long ago. Just thought I'd mention it. -- David Kastrup -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/4] Good bye fnmatch
On Sat, Feb 15, 2014 at 3:23 PM, David Kastrup d...@gnu.org wrote: Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: Long story short, we wanted globbing wildcard ** so I ripped wildmatch library from rsync to do it. Since version 3.0.0, rsync is GPLv3 URL:https://rsync.samba.org/GPL.html. So be sure to take an older version. Yes. See 5230f60 (Import wildmatch from rsync - 2012-10-15), the code was taken from the last GPL-2 commit. -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/4] Good bye fnmatch
Duy Nguyen pclo...@gmail.com writes: On Sat, Feb 15, 2014 at 3:23 PM, David Kastrup d...@gnu.org wrote: Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: Long story short, we wanted globbing wildcard ** so I ripped wildmatch library from rsync to do it. Since version 3.0.0, rsync is GPLv3 URL:https://rsync.samba.org/GPL.html. So be sure to take an older version. Yes. See 5230f60 (Import wildmatch from rsync - 2012-10-15), the code was taken from the last GPL-2 commit. Thanks. -- David Kastrup -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: error: src refspec refs/heads/master matches more than one.
On Fri, Feb 14, 2014 at 08:32:07AM -0800, Junio C Hamano wrote: Duy Nguyen pclo...@gmail.com writes: On Fri, Feb 14, 2014 at 7:45 PM, Andreas Schwab sch...@linux-m68k.org wrote: Josef Wolf j...@raven.inka.de writes: Notice the refs/heads _within_ refs/heads! Now I wonder how I managed to get into this situation and what's the best way to recover? Probably you did something like git branch refs/heads/master. You can remove it again with git branch -d refs/heads/master. As a porcelain, git branch should prevent (or at least warn) users from creating such refs, I think. warn, possibly, but I do not see a reason to *prevent*. A. You are not allowed to call your branch with a string that begins with 'refs/heads/'. B. Why? A. Because it will confuse you. B. I know what I am doing. A. ??? Prevent is a strong word. I meant we only do it if they force it. Something like this.. -- 8 -- diff --git a/branch.c b/branch.c index 723a36b..3f0540f 100644 --- a/branch.c +++ b/branch.c @@ -251,6 +251,11 @@ void create_branch(const char *head, forcing = 1; } + if (!force dwim_ref(name, strlen(name), sha1, real_ref)) + die(_(creating ref refs/heads/%s makes %s ambiguous.\n + Use -f to create it anyway.), + name, name); + real_ref = NULL; if (get_sha1(start_name, sha1)) { if (explicit_tracking) { -- 8 -- -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] reset: setup worktree on --mixed
--mixed does mainly two things: read_from_tree(), which does not require a worktree, and refresh_index(), which does. Reported-by: Patrick Palka patr...@parcs.ath.cx Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/reset.c | 2 +- t/t7102-reset.sh | 11 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/builtin/reset.c b/builtin/reset.c index 6004803..9928c28 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -320,7 +320,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) if (reset_type == NONE) reset_type = MIXED; /* by default */ - if (reset_type != SOFT reset_type != MIXED) + if (reset_type != SOFT) setup_work_tree(); if (reset_type == MIXED is_bare_repository()) diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 8d4b50d..ee117e2 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -535,4 +535,15 @@ test_expect_success 'reset with paths accepts tree' ' git diff HEAD --exit-code ' +test_expect_success 'reset --mixed sets up work tree' ' + git init mixed_worktree + ( + cd mixed_worktree + test_commit dummy + ) + : expect + git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset actual + test_cmp expect actual +' + test_done -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] reset: setup worktree on --mixed
On Sat, Feb 15, 2014 at 4:14 PM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: --mixed does mainly two things: read_from_tree(), which does not require a worktree, and refresh_index(), which does. .. and I should have run the entire test suite before sending this. It breaks t7103.5 (reset --mixed in bare repository). That test seems wrong though, in my opinon.. Reported-by: Patrick Palka patr...@parcs.ath.cx Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/reset.c | 2 +- t/t7102-reset.sh | 11 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/builtin/reset.c b/builtin/reset.c index 6004803..9928c28 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -320,7 +320,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) if (reset_type == NONE) reset_type = MIXED; /* by default */ - if (reset_type != SOFT reset_type != MIXED) + if (reset_type != SOFT) setup_work_tree(); if (reset_type == MIXED is_bare_repository()) diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 8d4b50d..ee117e2 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -535,4 +535,15 @@ test_expect_success 'reset with paths accepts tree' ' git diff HEAD --exit-code ' +test_expect_success 'reset --mixed sets up work tree' ' + git init mixed_worktree + ( + cd mixed_worktree + test_commit dummy + ) + : expect + git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset actual + test_cmp expect actual +' + test_done -- 1.8.5.2.240.g8478abd -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [PATCH] Provide a release-notes man page / guide
Use the symlinked RelNote file as a list-block to act as the core of the release-notes man page. The mantainers work load should not be affected. Signed-off-by: Philip Oakley philipoak...@iee.org --- The included lines are inset 11 spaces by the man page asciidoc formatting so some are more than 80 characters long. No negative indent mechanism for the list block was found - suggestions welcomed. The use of the stalenotes section from git(1) was rejected. The stalenotes, with over two hundred links, has greater than 2 digits allowed in the trailing link list on the man page, so would miss the hundreds digit. Also the html links for the documentation for release x.y.z (at kerenel.org) are to html files that are not actually made by the makefile. --- Documentation/Makefile | 1 + Documentation/gitrelease-notes.txt | 37 + 2 files changed, 38 insertions(+) create mode 100644 Documentation/gitrelease-notes.txt diff --git a/Documentation/Makefile b/Documentation/Makefile index fc6b2cf..b599b1f 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -29,6 +29,7 @@ MAN7_TXT += gitdiffcore.txt MAN7_TXT += gitglossary.txt MAN7_TXT += gitnamespaces.txt MAN7_TXT += gitrevisions.txt +MAN7_TXT += gitrelease-notes.txt MAN7_TXT += gittutorial-2.txt MAN7_TXT += gittutorial.txt MAN7_TXT += gitworkflows.txt diff --git a/Documentation/gitrelease-notes.txt b/Documentation/gitrelease-notes.txt new file mode 100644 index 000..29d9b1b --- /dev/null +++ b/Documentation/gitrelease-notes.txt @@ -0,0 +1,37 @@ +gitrelease-notes(7) +=== + +NAME + +gitrelease-notes - the onward progress of the stupid content tracker + + +SYNOPSIS + +[verse] +'git help release-notes' + +DESCRIPTION +--- + +Provide the release notes for the latest (possibly +unreleased) version of Git, that is available from 'master' +branch of the `git.git` repository. + +RELEASE NOTES +- + + +include::../RelNotes[] + + +OLDER RELEASE NOTES +--- + +Release notes for older versions are available in the Git source +Documentation/RelNotes/ folder. This is currently available at +https://code.google.com/p/git-core/source/browse/ + +GIT +--- +Part of the linkgit:git[1] suite -- 1.8.3.msysgit.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Git GSoC 2014
On Sat, Feb 15, 2014 at 7:17 PM, Thomas Rast t...@thomasrast.ch wrote: It also includes an ok from Nicolas Pitre, who has been the driving force behind packv5 development. The only thing that makes me uneasy is Nit: pack v4. You are probably confused with index v5, which is also cooking for a while now. that Duy is not in the list (Duy, have you been asked by libgit2 about possible relicensing?). I don't remember. But for the record I'm OK with relicensing my contributions in git.git for inclusion in libgit2. -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Git GSoC 2014
Thomas Rast t...@thomasrast.ch writes: David Kastrup d...@gnu.org writes: This definitely should not be we'll think about it if and when that project is finished material. Yes, all of this is true. However, you are painting a big devil on the wall. [...] Your scenario above mostly applies if and when we really go the way of my dream and scrap the code that is in git. So it's not a big devil I am painting but rather the consequences if everything goes according to plan. (I have similar long-term dreams for other git components like ref storage and diffs, but that's just me.) Second, how many contributions would actually have been prevented by GPLv2+LE licensing? That's not as much the question as to how many will be prevented in future by such a step. The libgit2 community is different from that of Git and with a different focus. If you take a look at its front page, you'll see statements like Link with open and proprietary software. No strings attached. and Trusted and used in production by GitHub, Microsoft, [...]. A fusion with this project and its aims and licensing will have consequences regarding which developers and users are attracted to Git. The act first, think later approach is not really doing anybody favors, and I don't consider it fair to GSoC students to employ them for making this proposal gain leverage: one should first think this through on behalf of the project before putting students to work on this so that they know reasonably well what will happen with their work. The kind of Now that we made $x do $y, we are obliged to do $z. scenario is easy to avoid by _first_ contemplating whether or not $z is where one wants to go. That's not painting a devil but common sense. I'm not saying that the answer is in any way self-evident. Merely that the best time to answer it is _before_ getting invested. The only data I have on this is libgit2/git.git-authors, which records who has consented for their _existing_ code to be relicensed. I consider this to be a higher barrier than contributing new code, since there's no clear gain for the author in the relicensing. I consider it a lower barrier since the work is already done, and the authors did not when doing it think about proprietary spinoffs. But that's a minor point. All I am saying is that there are different opinions possible, and picking a particular path for future development will in either way influence who wants to be part of the respective communities. -- David Kastrup -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] provide a Git user-manual man page
This is a resend of my original patch ($gman/240486), which disappeared without comment. I've cc'd those who have touched the User-Manual in the last year for comment on the provision of this access mechanism. The Git User Manual is formatted as a doc book, rather than as a man page so isn't directly accessible via the usual 'git help guide' command. This patch provides a simple man page with onward links to the true User-Manual. The man page is based directly on a very cut down version of the git(1) page. This patch is based on 1.9.0 master. Philip Oakley (1): Provide a 'git help user-manual' route to the docbook Documentation/Makefile | 1 + Documentation/gituser-manual.txt | 34 ++ builtin/help.c | 1 + 3 files changed, 36 insertions(+) create mode 100644 Documentation/gituser-manual.txt -- 1.8.3.msysgit.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Provide a 'git help user-manual' route to the docbook
Signed-off-by: Philip Oakley philipoak...@iee.org --- Documentation/Makefile | 1 + Documentation/gituser-manual.txt | 34 ++ builtin/help.c | 1 + 3 files changed, 36 insertions(+) create mode 100644 Documentation/gituser-manual.txt diff --git a/Documentation/Makefile b/Documentation/Makefile index fc6b2cf..657523f 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -31,6 +31,7 @@ MAN7_TXT += gitnamespaces.txt MAN7_TXT += gitrevisions.txt MAN7_TXT += gittutorial-2.txt MAN7_TXT += gittutorial.txt +MAN7_TXT += gituser-manual.txt MAN7_TXT += gitworkflows.txt MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT) diff --git a/Documentation/gituser-manual.txt b/Documentation/gituser-manual.txt new file mode 100644 index 000..9fd4744 --- /dev/null +++ b/Documentation/gituser-manual.txt @@ -0,0 +1,34 @@ +gituser-manual(7) += + +NAME + +gituser-manual - a link to the user-manual docbook + + +SYNOPSIS + +[verse] +'git help user-manual' + +link:user-manual.html[Git User's Manual] + +DESCRIPTION +--- +Git is a fast, scalable, distributed revision control system with an +unusually rich command set that provides both high-level operations +and full access to internals. + +The link:user-manual.html[Git User's Manual] provides an +in-depth introduction to Git. + +SEE ALSO + +linkgit:gittutorial[7], +linkgit:giteveryday[7], +linkgit:gitcli[7], +linkgit:gitworkflows[7] + +GIT +--- +Part of the linkgit:git[1] suite diff --git a/builtin/help.c b/builtin/help.c index 1fdefeb..be7c39d 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -427,6 +427,7 @@ static struct { { modules, N_(Defining submodule properties) }, { revisions, N_(Specifying revisions and ranges for Git) }, { tutorial, N_(A tutorial introduction to Git (for version 1.5.1 or newer)) }, + { user-manual, N_(A link to the user-manual docbook) }, { workflows, N_(An overview of recommended workflows with Git) }, }; -- 1.8.3.msysgit.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Fix documentation AsciiDoc links for external urls
Turns out that putting 'link:' before the 'http' is actually superfluous in AsciiDoc, as there's already a predefined macro to handle it. http, https, [etc] URLs are rendered using predefined inline macros. http://www.methods.co.nz/asciidoc/userguide.html#_urls Hypertext links to files on the local file system are specified using the link inline macro. http://www.methods.co.nz/asciidoc/userguide.html#_linking_to_local_documents Despite being superfluous, the reference implementation of AsciiDoc tolerates the extra 'link:' and silently removes it, giving a functioning link in the generated HTML. However, AsciiDoctor (the Ruby implementation of AsciiDoc used to render the http://git-scm.com/ site) does /not/ have this behaviour, and so generates broken links, as can be seen here: http://git-scm.com/docs/git-cvsimport (links to cvs2git parsecvs) http://git-scm.com/docs/git-filter-branch (link to The BFG) It's worth noting that after this change, the html generated by 'make html' in the git project is identical, and all links still work. --- Documentation/git-cvsimport.txt | 4 ++-- Documentation/git-filter-branch.txt | 4 ++-- Documentation/gitcore-tutorial.txt| 2 +- Documentation/gitcvs-migration.txt| 2 +- Documentation/gitweb.txt | 2 +- Documentation/technical/http-protocol.txt | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index 2df9953..260f39f 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -21,8 +21,8 @@ DESCRIPTION *WARNING:* `git cvsimport` uses cvsps version 2, which is considered deprecated; it does not work with cvsps version 3 and later. If you are performing a one-shot import of a CVS repository consider using -link:http://cvs2svn.tigris.org/cvs2git.html[cvs2git] or -link:https://github.com/BartMassey/parsecvs[parsecvs]. +http://cvs2svn.tigris.org/cvs2git.html[cvs2git] or +https://github.com/BartMassey/parsecvs[parsecvs]. Imports a CVS repository into Git. It will either create a new repository, or incrementally import into an existing one. diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt index 2eba627..09535f2 100644 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@ -436,7 +436,7 @@ git-filter-branch allows you to make complex shell-scripted rewrites of your Git history, but you probably don't need this flexibility if you're simply _removing unwanted data_ like large files or passwords. For those operations you may want to consider -link:http://rtyley.github.io/bfg-repo-cleaner/[The BFG Repo-Cleaner], +http://rtyley.github.io/bfg-repo-cleaner/[The BFG Repo-Cleaner], a JVM-based alternative to git-filter-branch, typically at least 10-50x faster for those use-cases, and with quite different characteristics: @@ -455,7 +455,7 @@ characteristics: _is_ possible to write filters that include their own parallellism, in the scripts executed against each commit. -* The link:http://rtyley.github.io/bfg-repo-cleaner/#examples[command options] +* The http://rtyley.github.io/bfg-repo-cleaner/#examples[command options] are much more restrictive than git-filter branch, and dedicated just to the tasks of removing unwanted data- e.g: `--strip-blobs-bigger-than 1M`. diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt index 058a352..d2d7c21 100644 --- a/Documentation/gitcore-tutorial.txt +++ b/Documentation/gitcore-tutorial.txt @@ -1443,7 +1443,7 @@ Although Git is a truly distributed system, it is often convenient to organize your project with an informal hierarchy of developers. Linux kernel development is run this way. There is a nice illustration (page 17, Merges to Mainline) in -link:http://www.xenotime.net/linux/mentor/linux-mentoring-2006.pdf[Randy Dunlap's presentation]. +http://www.xenotime.net/linux/mentor/linux-mentoring-2006.pdf[Randy Dunlap's presentation]. It should be stressed that this hierarchy is purely *informal*. There is nothing fundamental in Git that enforces the chain of diff --git a/Documentation/gitcvs-migration.txt b/Documentation/gitcvs-migration.txt index 5ea94cb..5f4e890 100644 --- a/Documentation/gitcvs-migration.txt +++ b/Documentation/gitcvs-migration.txt @@ -117,7 +117,7 @@ Importing a CVS archive --- First, install version 2.1 or higher of cvsps from -link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make +http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make sure it is in your path. Then cd to a checked out CVS working directory of the project you are interested in and run linkgit:git-cvsimport[1]: diff --git a/Documentation/gitweb.txt b/Documentation/gitweb.txt index cca14b8..cd9c895 100644 --- a/Documentation/gitweb.txt +++ b/Documentation/gitweb.txt @@ -84,7 +84,7 @@ separator
[PATCH] git-contacts: do not fail parsing of good diffs
If a line in a patch starts with --- it will be deemed malformed unless it also contains the proper diff header format. This situation can happen with a valid patch if it has a line starting with -- and that line is removed. This patch just removes the check in git-contacts. Signed-off-by: Lars Gullik Bjønnes lar...@gullik.org --- contrib/contacts/git-contacts | 2 -- 1 file changed, 2 deletions(-) diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts index 428cc1a..dbe2abf 100755 --- a/contrib/contacts/git-contacts +++ b/contrib/contacts/git-contacts @@ -96,8 +96,6 @@ sub scan_patches { next unless $id; if (m{^--- (?:a/(.+)|/dev/null)$}) { $source = $1; - } elsif (/^--- /) { - die Cannot parse hunk source: $_\n; } elsif (/^@@ -(\d+)(?:,(\d+))?/ $source) { my $len = defined($2) ? $2 : 1; push @{$sources-{$source}{$id}}, [$1, $len] if $len; -- 1.9.0 -- Lgb -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
the top few commits disappeared after 'git rebase origin'
(I have already worked around the issue, but just would like to report it and perhaps discuss - please cc'd as I am not subscribed). I noticed one or two most recent commits I made a few days ago is not around, so I thought I have mis-remembered it or forgot to do 'git add' (it was adding some reference notes file from somebody else). But then I saw in my bash command history that I did all the right things so the new files must be committed somewhere. Then I google'd, and read about 'git reflog', and indeed I did commit those new files 3 days ago, but they were not applied after a particular rebase origin. I do a fetch/rebase every few days, normally straight-forward without collision since I am working in some niche area of a busy project. Anyway, I was able to do 'git checkout -b recovery_branch sha1_head_before_rebase' to recover the whole thing. This gets me a bit worried - as it is a busy project, and I have some 20-30 local commits which are probably staying local for my convenience for months and years, and I do git rebase all the time. The only thing different I do this time, as far as I see, was to do 'git branch -m master master_date' (so that I can do a cleaner master with tidied up and collapsed/refactored commits of local changes) just before. The repo is on ext4, with a healthy amount of empty space. The commits which disappeared were the most recent 3. and git fsck --unreachable/--dangling /--strict don't show those disappearing ones. I seem to remember I had a similar incident (may or may not be with a 'git branch -m currentbranch' - I don't remember) but the new HEAD was so wrong - and essentially just a few local commits were applied - I did a 'git checkout -b recovery_branch sha1_from_scrollingback_to_the_last_git-log-display' and just forgotten about it soon. Any idea how this might happen, and perhaps make sure it does not happen again, ever? By the way, this is all essentially on fedora x86_64 linux. $ git --version git version 1.8.5.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Is there something like a blamed diff?
When comparing two branches, decorating the flat diff with the respectively responsible commits seems like it would be nice to do/have (the blame on the identical parts, in contrast, is not really interesting). Is there any tool that provides something like that? -- David Kastrup -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] Wider exposure for index-v4
Hi, since index-v5 didn't seem to generate enough interest to be merged, I have a few patches that give users users easier access to index-v4. Until now users have to go into the source code and compile git themselves to use index-v4 by default, or use git-update-index to change the index file to the new version. With this patches it's possible to set the default index file format either in gitconfig or in an environment variable. It also simplifies testing index-v4 by adding a Makefile knob to use it for running the test suite. For safety, existing repositories are not changed when the environment or the config variables are set. I'm not sure about the precedence in patch 3, right now the environment variable has precedence, but it should be easy to give the config option precedence over that. Thomas Gummerer (3): introduce GIT_INDEX_VERSION environment variable test-lib: allow setting the index format version read-cache: add index.version config variable Documentation/config.txt | 4 +++ Documentation/git.txt | 5 Makefile | 7 + read-cache.c | 36 +++- t/t1600-index.sh | 52 +++ t/t2104-update-index-skip-worktree.sh | 2 ++ t/test-lib-functions.sh | 5 t/test-lib.sh | 3 ++ 8 files changed, 113 insertions(+), 1 deletion(-) create mode 100755 t/t1600-index.sh -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] test-lib: allow setting the index format version
Allow adding a TEST_GIT_INDEX_VERSION variable to config.mak to set the index version with which the test suite should be run. If it isn't set, the default version given in the source code is used (currently version 3). To avoid breakages with index versions other than [23], also set the index version under which t2104 is run to 3. This test only tests functionality specific to version 2 and 3 of the index file and would fail if the test suite is run with any other version. Signed-off-by: Thomas Gummerer t.gumme...@gmail.com --- Makefile | 7 +++ t/t2104-update-index-skip-worktree.sh | 2 ++ t/test-lib-functions.sh | 5 + t/test-lib.sh | 3 +++ 4 files changed, 17 insertions(+) diff --git a/Makefile b/Makefile index 287e6f8..c98d28f 100644 --- a/Makefile +++ b/Makefile @@ -342,6 +342,10 @@ all:: # Define DEFAULT_HELP_FORMAT to man, info or html # (defaults to man) if you want to have a different default when # git help is called without a parameter specifying the format. +# +# Define TEST_GIT_INDEX_FORMAT to 2, 3 or 4 to run the test suite +# with a different indexfile format. If it isn't set the index file +# format used is index-v[23]. GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -2223,6 +2227,9 @@ endif ifdef GIT_PERF_MAKE_OPTS @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' $@ endif +ifdef TEST_GIT_INDEX_VERSION + @echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' $@ +endif ### Detect Python interpreter path changes ifndef NO_PYTHON diff --git a/t/t2104-update-index-skip-worktree.sh b/t/t2104-update-index-skip-worktree.sh index 1d0879b..29c1fb1 100755 --- a/t/t2104-update-index-skip-worktree.sh +++ b/t/t2104-update-index-skip-worktree.sh @@ -7,6 +7,8 @@ test_description='skip-worktree bit test' . ./test-lib.sh +test_set_index_version 3 + cat expect.full EOF H 1 H 2 diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index aeae3ca..0bf1e63 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -32,6 +32,11 @@ test_set_editor () { export EDITOR } +test_set_index_version () { +GIT_INDEX_VERSION=$1 +export GIT_INDEX_VERSION +} + test_decode_color () { awk ' function name(n) { diff --git a/t/test-lib.sh b/t/test-lib.sh index 1cf78d5..e6cf5b0 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -108,6 +108,9 @@ export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME export EDITOR +GIT_INDEX_VERSION=$TEST_GIT_INDEX_VERSION +export GIT_INDEX_VERSION + # Add libc MALLOC and MALLOC_PERTURB test # only if we are not executing the test with valgrind if expr $GIT_TEST_OPTS : .* --valgrind /dev/null || -- 1.8.5.2.300.ge613be6.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] introduce GIT_INDEX_VERSION environment variable
Respect a GIT_INDEX_VERSION environment variable, when a new index is initialized. Setting the environment variable will not cause existing index files to be converted to another format, but will only affect newly written index files. This can be used to initialize repositories with index-v4. Signed-off-by: Thomas Gummerer t.gumme...@gmail.com --- Documentation/git.txt | 5 + read-cache.c | 18 +- t/t1600-index.sh | 24 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 t/t1600-index.sh diff --git a/Documentation/git.txt b/Documentation/git.txt index aec3726..bc9eeea 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -712,6 +712,11 @@ Git so take care if using Cogito etc. index file. If not specified, the default of `$GIT_DIR/index` is used. +'GIT_INDEX_VERSION':: + This environment variable allows the specification of an index + version for new repositories. It won't affect existing index + files. By default index file version 3 is used. + 'GIT_OBJECT_DIRECTORY':: If the object storage directory is specified via this environment variable then the sha1 directories are created diff --git a/read-cache.c b/read-cache.c index 3f735f3..3993e12 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1223,6 +1223,22 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall #define INDEX_FORMAT_DEFAULT 3 +static unsigned int get_index_format_default() +{ + char *envversion = getenv(GIT_INDEX_VERSION); + if (!envversion) { + return INDEX_FORMAT_DEFAULT; + } else { + unsigned int version = strtol(envversion, NULL, 10); + if (version INDEX_FORMAT_LB || version INDEX_FORMAT_UB) { + warning(_(GIT_INDEX_VERSION set, but the value is invalid.\n + Using version %i), INDEX_FORMAT_DEFAULT); + version = INDEX_FORMAT_DEFAULT; + } + return version; + } +} + /* * dev/ino/uid/gid/size are also just tracked to the low 32 bits * Again - this is just a (very strong in practice) heuristic that @@ -1799,7 +1815,7 @@ int write_index(struct index_state *istate, int newfd) } if (!istate-version) - istate-version = INDEX_FORMAT_DEFAULT; + istate-version = get_index_format_default(); /* demote version 3 to version 2 when the latter suffices */ if (istate-version == 3 || istate-version == 2) diff --git a/t/t1600-index.sh b/t/t1600-index.sh new file mode 100755 index 000..37fd84d --- /dev/null +++ b/t/t1600-index.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +test_description='index file specific tests' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo 1 a +' + +test_expect_success 'out of bounds GIT_INDEX_VERSION issues warning' ' + ( + GIT_INDEX_VERSION=1 + export GIT_INDEX_VERSION + git add a 21 | sed s/[0-9]// actual.err + sed -e s/ Z$/ / -\EOF expect.err + warning: GIT_INDEX_VERSION set, but the value is invalid. + Using version Z + EOF + test_i18ncmp expect.err actual.err + ) +' + +test_done -- 1.8.5.2.300.ge613be6.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] read-cache: add index.version config variable
Add a config variable that allows setting the default index version when initializing a new index file. Similar to the GIT_INDEX_VERSION environment variable this only affects new index files. Signed-off-by: Thomas Gummerer t.gumme...@gmail.com --- Documentation/config.txt | 4 read-cache.c | 27 ++- t/t1600-index.sh | 27 +++ 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 1655455..033939a 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1591,6 +1591,10 @@ imap:: The configuration variables in the 'imap' section are described in linkgit:git-imap-send[1]. +index.version:: + Specify the version with which new index files should be + initialized. This does not affect existing repositories. + init.templatedir:: Specify the directory from which templates will be copied. (See the TEMPLATE DIRECTORY section of linkgit:git-init[1].) diff --git a/read-cache.c b/read-cache.c index 3993e12..ca9b68c 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1223,20 +1223,37 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall #define INDEX_FORMAT_DEFAULT 3 +static int index_format_config(const char *var, const char *value, void *cb) +{ + unsigned int *version = cb; + if (!strcmp(var, index.version)) { + *version = git_config_int(var, value); + return 0; + } + return 1; +} + + static unsigned int get_index_format_default() { char *envversion = getenv(GIT_INDEX_VERSION); + unsigned int version = INDEX_FORMAT_DEFAULT; if (!envversion) { - return INDEX_FORMAT_DEFAULT; - } else { - unsigned int version = strtol(envversion, NULL, 10); + git_config(index_format_config, version); if (version INDEX_FORMAT_LB || version INDEX_FORMAT_UB) { - warning(_(GIT_INDEX_VERSION set, but the value is invalid.\n + warning(_(index.version set, but the value is invalid.\n Using version %i), INDEX_FORMAT_DEFAULT); - version = INDEX_FORMAT_DEFAULT; + return INDEX_FORMAT_DEFAULT; } return version; } + version = strtol(envversion, NULL, 10); + if (version INDEX_FORMAT_LB || version INDEX_FORMAT_UB) { + warning(_(GIT_INDEX_VERSION set, but the value is invalid.\n + Using version %i), INDEX_FORMAT_DEFAULT); + version = INDEX_FORMAT_DEFAULT; + } + return version; } /* diff --git a/t/t1600-index.sh b/t/t1600-index.sh index 37fd84d..bf34985 100755 --- a/t/t1600-index.sh +++ b/t/t1600-index.sh @@ -21,4 +21,31 @@ test_expect_success 'out of bounds GIT_INDEX_VERSION issues warning' ' ) ' +test_expect_success 'out of bounds index.version issuses warning' ' + ( + unset GIT_INDEX_VERSION + rm .git/index + git config --add index.version 1 + git add a 21 | sed s/[0-9]// actual.err + sed -e s/ Z$/ / -\EOF expect.err + warning: index.version set, but the value is invalid. + Using version Z + EOF + test_i18ncmp expect.err actual.err + ) +' + +test_expect_success 'GIT_INDEX_VERSION takes precedence over config' ' + ( + rm .git/index + GIT_INDEX_VERSION=4 + export GIT_INDEX_VERSION + git config --add index.version 2 + git add a 21 + echo 4 expect + test-index-version .git/index actual + test_cmp expect actual + ) +' + test_done -- 1.8.5.2.300.ge613be6.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Git GSoC 2014
On Sat, Feb 15, 2014 at 4:17 AM, Thomas Rast t...@thomasrast.ch wrote: David Kastrup d...@gnu.org writes: Thomas Rast t...@thomasrast.ch writes: Motivation: I believe that migrating to libgit2 is the better approach, medium term, than rewriting everything ourselves to be nice, clean and thread-safe. I took a shot a while ago at making the pack reading code thread-safe, but it's adding mess when we could simply replace it all by the already thread-safe libgit2 calls. It also helps shake out incompatibilities in libgit2. That would either require forking libgit2 for Git use or stop dead any contributions to that rather central part of the git codebase from contributors not wanting their contributions to get reused in binary proprietary software. It would also mean that no serious forward-going work (like developing new packing formats or network protocols) can be done on a pure GPLv2 codebase any more. So anybody insisting on contributing work under the current Git license only would be locked out from working on significant parts of Git and could no longer propose changes in central parts. Now this can all be repealed by the developing the atomic bomb does not mean that one has to use it argument but even if one does not use it, the world with and without it are different worlds and occupy mindshare and suggest solutions and diplomacy involving it. So this is definitely a large step towards a situation where erosion of the existing license and related parts of the community becomes more attractive. There is the rationale we can always say no at the end. How do you explain this no to the student who invested significant amounts of work into this, in a project proposed by the Git developers? This definitely should not be we'll think about it if and when that project is finished material. Yes, all of this is true. However, you are painting a big devil on the wall. ... Second, how many contributions would actually have been prevented by GPLv2+LE licensing? Interesting data point, I helped get libgit2 started in the first few days of its existence and discussed the license on the mailing list. I eventually stopped contributing, partly because of the GPLv2+LE license it uses. :-) I am not as interested in using the GPL for my work as David Kastrup is, but I wasn't really thrilled with GPLv2+LE. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/3] Wider exposure for index-v4
On Sun, Feb 16, 2014 at 2:23 AM, Thomas Gummerer t.gumme...@gmail.com wrote: Hi, since index-v5 didn't seem to generate enough interest to be merged, I I thought there were some comments last time that you were going to address and resubmit? have a few patches that give users users easier access to index-v4. Until now users have to go into the source code and compile git themselves to use index-v4 by default, or use git-update-index to change the index file to the new version. Not objecting this, but I think something like [1] would give v4 more exposure. Reading the patch again, I think putting that detection code in unpack_trees() or git-merge may make more sense because people will be advised about upgrading to v4 at the next fast-forward. [1] http://article.gmane.org/gmane.comp.version-control.git/216307 With this patches it's possible to set the default index file format either in gitconfig or in an environment variable. It also simplifies testing index-v4 by adding a Makefile knob to use it for running the test suite. For safety, existing repositories are not changed when the environment or the config variables are set. I'm not sure about the precedence in patch 3, right now the environment variable has precedence, but it should be easy to give the config option precedence over that. Thomas Gummerer (3): introduce GIT_INDEX_VERSION environment variable test-lib: allow setting the index format version read-cache: add index.version config variable Documentation/config.txt | 4 +++ Documentation/git.txt | 5 Makefile | 7 + read-cache.c | 36 +++- t/t1600-index.sh | 52 +++ t/t2104-update-index-skip-worktree.sh | 2 ++ t/test-lib-functions.sh | 5 t/test-lib.sh | 3 ++ 8 files changed, 113 insertions(+), 1 deletion(-) create mode 100755 t/t1600-index.sh -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] read-cache: add index.version config variable
On Sat, Feb 15, 2014 at 2:23 PM, Thomas Gummerer t.gumme...@gmail.com wrote: Add a config variable that allows setting the default index version when initializing a new index file. Similar to the GIT_INDEX_VERSION environment variable this only affects new index files. Signed-off-by: Thomas Gummerer t.gumme...@gmail.com --- index 37fd84d..bf34985 100755 --- a/t/t1600-index.sh +++ b/t/t1600-index.sh @@ -21,4 +21,31 @@ test_expect_success 'out of bounds GIT_INDEX_VERSION issues warning' ' ) ' +test_expect_success 'out of bounds index.version issuses warning' ' s/issuses/issues/ + ( + unset GIT_INDEX_VERSION + rm .git/index + git config --add index.version 1 + git add a 21 | sed s/[0-9]// actual.err + sed -e s/ Z$/ / -\EOF expect.err + warning: index.version set, but the value is invalid. + Using version Z + EOF + test_i18ncmp expect.err actual.err + ) +' + +test_expect_success 'GIT_INDEX_VERSION takes precedence over config' ' + ( + rm .git/index + GIT_INDEX_VERSION=4 + export GIT_INDEX_VERSION + git config --add index.version 2 + git add a 21 + echo 4 expect + test-index-version .git/index actual + test_cmp expect actual + ) +' + test_done -- 1.8.5.2.300.ge613be6.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] config: teach git config --file - to read from the standard input
On Fri, Feb 14, 2014 at 6:37 PM, Kirill A. Shutemov kir...@shutemov.name wrote: The patch extends git config --file interface to allow read config from stdin. Editing stdin or setting value in stdin is an error. Include by absolute path is allowed in stdin config, but not by relative path. Signed-off-by: Kirill A. Shutemov kir...@shutemov.name --- diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh index a70707620f14..fda6555024c5 100755 --- a/t/t1305-config-include.sh +++ b/t/t1305-config-include.sh @@ -122,6 +122,20 @@ test_expect_success 'relative includes from command line fail' ' test_must_fail git -c include.path=one config test.one ' +test_expect_success 'absolute includes from stdin work' ' + echo [test]one = 1 one + echo 1 expect + echo [include]path=\$PWD/one\ | To be Windows-friendly, you may want to use $(pwd). Quoting from t/README: When a test checks for an absolute path that a git command generated, construct the expected value using $(pwd) rather than $PWD, $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on Windows, where the shell (MSYS bash) mangles absolute path names. For details, see the commit message of 4114156ae9. + git config --file - test.one actual + test_cmp expect actual +' + +test_expect_success 'relative includes from stdin line fail' ' + echo [test]one = 1 one + echo [include]path=one | + test_must_fail git config --file - test.one +' + test_expect_success 'include cycles are detected' ' cat .gitconfig -\EOF [test]value = gitconfig -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] reset: optionally setup worktree and refresh index on --mixed
Refreshing index requires work tree. So we have to options: always set up work tree (and refuse to reset if failing to do so), or make refreshing index optional. As refreshing index is not the main task, it makes more sense to make it optional. Reported-by: Patrick Palka patr...@parcs.ath.cx Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/reset.c | 7 --- t/t7102-reset.sh | 11 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 6004803..a991344 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -320,7 +320,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) if (reset_type == NONE) reset_type = MIXED; /* by default */ - if (reset_type != SOFT reset_type != MIXED) + if (reset_type != SOFT (reset_type != MIXED || get_git_work_tree())) setup_work_tree(); if (reset_type == MIXED is_bare_repository()) @@ -340,8 +340,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix) int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN; if (read_from_tree(pathspec, sha1)) return 1; - refresh_index(the_index, flags, NULL, NULL, - _(Unstaged changes after reset:)); + if (get_git_work_tree()) + refresh_index(the_index, flags, NULL, NULL, + _(Unstaged changes after reset:)); } else { int err = reset_index(sha1, reset_type, quiet); if (reset_type == KEEP !err) diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 8d4b50d..ee117e2 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -535,4 +535,15 @@ test_expect_success 'reset with paths accepts tree' ' git diff HEAD --exit-code ' +test_expect_success 'reset --mixed sets up work tree' ' + git init mixed_worktree + ( + cd mixed_worktree + test_commit dummy + ) + : expect + git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset actual + test_cmp expect actual +' + test_done -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] reset: optionally setup worktree and refresh index on --mixed
On Sat, Feb 15, 2014 at 9:28 PM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: Refreshing index requires work tree. So we have to options: always set s/to/two/ up work tree (and refuse to reset if failing to do so), or make refreshing index optional. As refreshing index is not the main task, it makes more sense to make it optional. Reported-by: Patrick Palka patr...@parcs.ath.cx Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- builtin/reset.c | 7 --- t/t7102-reset.sh | 11 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/builtin/reset.c b/builtin/reset.c index 6004803..a991344 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -320,7 +320,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) if (reset_type == NONE) reset_type = MIXED; /* by default */ - if (reset_type != SOFT reset_type != MIXED) + if (reset_type != SOFT (reset_type != MIXED || get_git_work_tree())) setup_work_tree(); if (reset_type == MIXED is_bare_repository()) @@ -340,8 +340,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix) int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN; if (read_from_tree(pathspec, sha1)) return 1; - refresh_index(the_index, flags, NULL, NULL, - _(Unstaged changes after reset:)); + if (get_git_work_tree()) + refresh_index(the_index, flags, NULL, NULL, + _(Unstaged changes after reset:)); } else { int err = reset_index(sha1, reset_type, quiet); if (reset_type == KEEP !err) diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 8d4b50d..ee117e2 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -535,4 +535,15 @@ test_expect_success 'reset with paths accepts tree' ' git diff HEAD --exit-code ' +test_expect_success 'reset --mixed sets up work tree' ' + git init mixed_worktree + ( + cd mixed_worktree + test_commit dummy + ) + : expect + git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset actual + test_cmp expect actual +' + test_done -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] wt-status.c: move cut-line print code out to wt_status_add_cut_line
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- wt-status.c | 19 --- wt-status.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/wt-status.c b/wt-status.c index 65e35c3..ed31b6a 100644 --- a/wt-status.c +++ b/wt-status.c @@ -808,6 +808,17 @@ void wt_status_truncate_message_at_cut_line(struct strbuf *buf) strbuf_release(pattern); } +void wt_status_add_cut_line(FILE *fp) +{ + const char *explanation = _(Do not touch the line above.\nEverything below will be removed.); + struct strbuf buf = STRBUF_INIT; + + fprintf(fp, %c %s, comment_line_char, cut_line); + strbuf_add_commented_lines(buf, explanation, strlen(explanation)); + fputs(buf.buf, fp); + strbuf_release(buf); +} + static void wt_status_print_verbose(struct wt_status *s) { struct rev_info rev; @@ -833,14 +844,8 @@ static void wt_status_print_verbose(struct wt_status *s) * diff before committing. */ if (s-fp != stdout) { - const char *explanation = _(Do not touch the line above.\nEverything below will be removed.); - struct strbuf buf = STRBUF_INIT; - rev.diffopt.use_color = 0; - fprintf(s-fp, %c %s, comment_line_char, cut_line); - strbuf_add_commented_lines(buf, explanation, strlen(explanation)); - fputs(buf.buf, s-fp); - strbuf_release(buf); + wt_status_add_cut_line(s-fp); } run_diff_index(rev, 1); } diff --git a/wt-status.h b/wt-status.h index 30a4812..b56ce3f 100644 --- a/wt-status.h +++ b/wt-status.h @@ -92,6 +92,7 @@ struct wt_status_state { }; void wt_status_truncate_message_at_cut_line(struct strbuf *); +void wt_status_add_cut_line(FILE *fp); void wt_status_prepare(struct wt_status *s); void wt_status_print(struct wt_status *s); void wt_status_collect(struct wt_status *s); -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] commit: add --cleanup=scissors
Since 1a72cfd (commit -v: strip diffs and submodule shortlogs from the commit message - 2013-12-05) we have a less fragile way to cut out git status at the end of a commit message but it's only enabled for stripping submodule shortlogs. Add new cleanup option that reuses the same mechanism for the entire git status without accidentally remove lines starting with '#' Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- Documentation/git-commit.txt | 7 ++- builtin/commit.c | 9 +++-- t/t7502-commit.sh| 16 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt index 1a7616c..98f976a 100644 --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@ -176,7 +176,7 @@ OPTIONS --cleanup=mode:: This option determines how the supplied commit message should be cleaned up before committing. The 'mode' can be `strip`, - `whitespace`, `verbatim`, or `default`. + `whitespace`, `verbatim`, `scissors` or `default`. + -- strip:: @@ -186,6 +186,11 @@ whitespace:: Same as `strip` except #commentary is not removed. verbatim:: Do not change the message at all. +scissors:: + Same as `whitespace`, except that everything from the line + `# 8 ` + is truncated if the message is to be edited. `#` could be + customized with core.commentChar. default:: Same as `strip` if the message is to be edited. Otherwise `whitespace`. diff --git a/builtin/commit.c b/builtin/commit.c index 3767478..ea2912f 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -113,6 +113,7 @@ static char *sign_commit; static enum { CLEANUP_SPACE, CLEANUP_NONE, + CLEANUP_SCISSORS, CLEANUP_ALL } cleanup_mode; static const char *cleanup_arg; @@ -777,6 +778,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, _(Please enter the commit message for your changes. Lines starting\nwith '%c' will be ignored, and an empty message aborts the commit.\n), comment_line_char); + else if (cleanup_mode == CLEANUP_SCISSORS) + wt_status_add_cut_line(s-fp); else /* CLEANUP_SPACE, that is. */ status_printf(s, GIT_COLOR_NORMAL, _(Please enter the commit message for your changes. @@ -1132,6 +1135,8 @@ static int parse_and_validate_options(int argc, const char *argv[], cleanup_mode = CLEANUP_SPACE; else if (!strcmp(cleanup_arg, strip)) cleanup_mode = CLEANUP_ALL; + else if (!strcmp(cleanup_arg, scissors)) + cleanup_mode = use_editor ? CLEANUP_SCISSORS : CLEANUP_SPACE; else die(_(Invalid cleanup mode %s), cleanup_arg); @@ -1600,8 +1605,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix) die(_(could not read commit message: %s), strerror(saved_errno)); } - /* Truncate the message just before the diff, if any. */ - if (verbose) + if (verbose || /* Truncate the message just before the diff, if any. */ + cleanup_mode == CLEANUP_SCISSORS) wt_status_truncate_message_at_cut_line(sb); if (cleanup_mode != CLEANUP_NONE) diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index 6313da2..9a3f3a1 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -223,6 +223,22 @@ test_expect_success 'cleanup commit messages (whitespace option,-F)' ' ' +test_expect_success 'cleanup commit messages (scissors option,-F,-e)' ' + + echo negative + cat text EOF + +# to be kept +# 8 +to be removed +EOF + echo # to be kept expect + git commit --cleanup=scissors -e -F text -a + git cat-file -p HEAD |sed -e 1,/^\$/dactual + test_cmp expect actual + +' + test_expect_success 'cleanup commit messages (strip option,-F)' ' echo negative -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] wt-status.c: make cut_lines[] const to shrink .data section a bit
Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- wt-status.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wt-status.c b/wt-status.c index 4e55810..65e35c3 100644 --- a/wt-status.c +++ b/wt-status.c @@ -17,7 +17,7 @@ #include strbuf.h #include utf8.h -static char cut_line[] = +static const char cut_line[] = 8 \n; static char default_wt_status_colors[][COLOR_MAXLEN] = { -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] commit --cleanup=scissors marker
I've been bitten by --cleanup=default stripping my # lines a few times. Cutting git status with a long scissors marker line reduces chances of that happening. Most of the code is already there in 1a72cfd. This is just to add the UI. Nguyễn Thái Ngọc Duy (3): wt-status.c: make cut_lines[] const to shrink .data section a bit wt-status.c: move cut-line print code out to wt_status_add_cut_line commit: add --cleanup=scissors Documentation/git-commit.txt | 7 ++- builtin/commit.c | 9 +++-- t/t7502-commit.sh| 16 wt-status.c | 21 + wt-status.h | 1 + 5 files changed, 43 insertions(+), 11 deletions(-) -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] commit: add --cleanup=scissors
On Sat, Feb 15, 2014 at 10:37 PM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote: Since 1a72cfd (commit -v: strip diffs and submodule shortlogs from the commit message - 2013-12-05) we have a less fragile way to cut out git status at the end of a commit message but it's only enabled for stripping submodule shortlogs. Add new cleanup option that reuses the same mechanism for the entire git status without accidentally remove s/remove/removing/ lines starting with '#' Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com --- diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt index 1a7616c..98f976a 100644 --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@ -176,7 +176,7 @@ OPTIONS --cleanup=mode:: This option determines how the supplied commit message should be cleaned up before committing. The 'mode' can be `strip`, - `whitespace`, `verbatim`, or `default`. + `whitespace`, `verbatim`, `scissors` or `default`. + -- strip:: @@ -186,6 +186,11 @@ whitespace:: Same as `strip` except #commentary is not removed. verbatim:: Do not change the message at all. +scissors:: + Same as `whitespace`, except that everything from the line + `# 8 ` Would it make sense to be more explicit and say that the 'cut' line is also removed? Same as `whitespace`, except that the line `# 8 ` and all lines following it are removed ... + is truncated if the message is to be edited. `#` could be s/could/can/ + customized with core.commentChar. default:: Same as `strip` if the message is to be edited. Otherwise `whitespace`. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[BUG?] git http connection reuse
I've noticed that git does not reuse http connections when fetching, and I'm trying to figure out why. It seems related to our use of two curl features: 1. If we use the curl_multi interface (even though we are doing the requests sequentially), we do not get reuse. 2. If we set CURLOPT_HTTPAUTH to CURLAUTH_ANY, we do not get reuse. It's fairly easy to replicate with the patch below. Running: rm -rf test GIT_CURL_VERBOSE=1 git clone https://github.com/peff/test 21 | grep -i connect produces this with stock git: * Connected to github.com (192.30.252.131) port 443 (#0) * SSL connection using ECDHE-RSA-AES128-GCM-SHA256 * Connection #0 to host github.com left intact * Connected to github.com (192.30.252.131) port 443 (#1) * SSL connection using ECDHE-RSA-AES128-GCM-SHA256 * Connection #1 to host github.com left intact and this with the patched git: * Connected to github.com (192.30.252.131) port 443 (#0) * SSL connection using ECDHE-RSA-AES128-GCM-SHA256 * Connection #0 to host github.com left intact * Re-using existing connection! (#0) with host github.com * Connected to github.com (192.30.252.131) port 443 (#0) * Connection #0 to host github.com left intact The patch itself just turns off our use of these features (and is obviously just for experimentation, not inclusion): diff --git a/http.c b/http.c index 70eaa26..8e642fa 100644 --- a/http.c +++ b/http.c @@ -313,9 +313,6 @@ static CURL *get_curl_handle(void) #if LIBCURL_VERSION_NUM = 0x070907 curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); #endif -#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY - curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY); -#endif if (http_proactive_auth) init_curl_http_auth(result); diff --git a/http.h b/http.h index cd37d58..6506347 100644 --- a/http.h +++ b/http.h @@ -18,11 +18,6 @@ */ #undef USE_CURL_MULTI -#if LIBCURL_VERSION_NUM = 0x071000 -#define USE_CURL_MULTI -#define DEFAULT_MAX_REQUESTS 5 -#endif - #if LIBCURL_VERSION_NUM 0x070704 #define curl_global_cleanup() do { /* nothing */ } while (0) #endif I'm trying to figure out whether these options do not support connection reuse for some reason, whether we are just invoking curl in a weird or wrong way, or whether it's a curl bug. The curl_multi code is a bit more complex, but here's a very simple program that demonstrates the issue with CURLAUTH_ANY: -- 8 -- #include stdio.h #include curl/curl.h int main(int argc, char **argv) { CURL *curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, argv[1]); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); if (argv[2]) curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_perform(curl); curl_easy_setopt(curl, CURLOPT_URL, argv[1]); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_perform(curl); return 0; } -- 8 -- Running it as ./a.out http://example.com; reuses the connection. Running ./a.out http://example.com break will set CURLOPT_HTTPAUTH, and cause curl to make two connections. Are we using curl wrong? Do we need to be touching CURLOPT_HTTPAUTH in between the requests (doing so does not seem to help)? My curl version is 7.35.0, if that makes a difference. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
what the text=auto docs should be
It would be better if the text=auto section of the gitattributes Manual Page had this: This ensures that all files that git considers to be the text will have normalized (LF) line endings in the repository. If core.autocrlf=true, core.eol will be used to normalize the files in your working directory. core.eol defaults to native line endings for your platform. I researched and put my thoughts down in a blog post: http://blog.ctaggart.com/2014/02/time-to-kill-carriage-return.html cheers, Cameron -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG?] git http connection reuse
On Feb 15, 2014, at 20:05, Jeff King wrote: I've noticed that git does not reuse http connections when fetching, and I'm trying to figure out why. It seems related to our use of two curl features: 1. If we use the curl_multi interface (even though we are doing the requests sequentially), we do not get reuse. Take a look at the curl_multi_setopt page [1]. I think these explain the curl_multi issue: CURLMOPT_PIPELINING Pass a long set to 1 to enable or 0 to disable. Enabling pipelining on a multi handle will make it attempt to perform HTTP Pipelining as far as possible for transfers using this handle. This means that if you add a second request that can use an already existing connection, the second request will be piped on the same connection rather than being executed in parallel. (Added in 7.16.0) CURLMOPT_MAX_TOTAL_CONNECTIONS Pass a long. The set number will be used as the maximum amount of simultaneously open connections in total. For each new session, libcurl will open a new connection up to the limit set by CURLMOPT_MAX_TOTAL_CONNECTIONS. When the limit is reached, the sessions will be pending until there are available connections. If CURLMOPT_PIPELINING is 1, libcurl will try to pipeline if the host is capable of it. The default value is 0, which means that there is no limit. However, for backwards compatibility, setting it to 0 when CURLMOPT_PIPELINING is 1 will not be treated as unlimited. Instead it will open only 1 connection and try to pipeline on it. (Added in 7.30.0) If pipelining is off (the default) and total connections is not 1 it sounds to me from the description above that the requests will be executed on separate connections until the maximum number of connections is in use and then there might be some reuse. That might not be what's actually going on with multi, but that's my guess and I think setting CURLMOPT_PIPELINING to to 1 and then also setting CURLMOPT_MAX_TOTAL_CONNECTIONS to a non-zero value might be what you want. 2. If we set CURLOPT_HTTPAUTH to CURLAUTH_ANY, we do not get reuse. [snip] My curl version is 7.35.0, if that makes a difference. And that is explained by this from the CHANGES file: Daniel Stenberg (7 Jan 2014) - ConnectionExists: fix NTLM check for new connection When the requested authentication bitmask includes NTLM, we cannot re-use a connection for another username/password as we then risk re-using NTLM (connection-based auth). This has the unfortunate downside that if you include NTLM as a possible auth, you cannot re-use connections for other usernames/passwords even if NTLM doesn't end up the auth type used. Reported-by: Paras S Patched-by: Paras S Bug: http://curl.haxx.se/mail/lib-2014-01/0046.html Looks like you're just lucky as that above change first appears in 7.35.0. But it seems there are some patches for older versions so they might be affected as well [2]. Adjusting your test program to leave the first connection set to CURLAUTH_ANY, but then setting the second one to CURLAUTH_ANY with the two NTLM bits turned off (CURLAUTH_NTLM and CURLAUTH_NTLM_WB) results in the connection being reused for me. :) With the older cURL versions I already had installed, the second connection is always reused. I didn't see the non-reuse with your sample code until I fetched 7.35.0. --Kyle [1] http://curl.haxx.se/libcurl/c/curl_multi_setopt.html [2] http://curl.haxx.se/docs/adv_20140129.html -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] web--browse: Use powershell on Windows
On Windows you can have either MinGW or Cygwin. As has been shown in this script MinGW uses start while Cygwin uses cygstart. The cygstart command is robust but the start command breaks on certain URLs $ git web--browse 'http://wikipedia.org/wiki/Key__Peele' '_Peele' is not recognized as an internal or external command, operable program or batch file. An alternative is to use PowerShell. PowerShell is a component of Windows and will work with both MinGW and Cygwin. Signed-off-by: Steven Penny svnp...@gmail.com --- Documentation/git-web--browse.txt | 3 +-- git-web--browse.sh| 19 --- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Documentation/git-web--browse.txt b/Documentation/git-web--browse.txt index 2de575f..02cccf9 100644 --- a/Documentation/git-web--browse.txt +++ b/Documentation/git-web--browse.txt @@ -33,8 +33,7 @@ The following browsers (or commands) are currently supported: * lynx * dillo * open (this is the default under Mac OS X GUI) -* start (this is the default under MinGW) -* cygstart (this is the default under Cygwin) +* powershell (this is the default under Windows) * xdg-open Custom commands may also be specified. diff --git a/git-web--browse.sh b/git-web--browse.sh index ebdfba6..72fbe32 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -34,7 +34,7 @@ valid_tool() { firefox | iceweasel | seamonkey | iceape | \ chrome | google-chrome | chromium | chromium-browser | \ konqueror | opera | w3m | elinks | links | lynx | dillo | open | \ - start | cygstart | xdg-open) + powershell | xdg-open) ;; # happy *) valid_custom_tool $1 || return 1 @@ -124,13 +124,10 @@ if test -z $browser ; then then browser_candidates=open $browser_candidates fi - # /bin/start indicates MinGW - if test -x /bin/start; then - browser_candidates=start $browser_candidates - fi - # /usr/bin/cygstart indicates Cygwin - if test -x /usr/bin/cygstart; then - browser_candidates=cygstart $browser_candidates + # OS indicates Windows + if test -n $OS + then + browser_candidates=powershell $browser_candidates fi for i in $browser_candidates; do @@ -179,11 +176,11 @@ konqueror) ;; esac ;; -w3m|elinks|links|lynx|open|cygstart|xdg-open) +w3m|elinks|links|lynx|open|xdg-open) $browser_path $@ ;; -start) - exec $browser_path 'web-browse' $@ +powershell) + $browser_path saps '$@' ;; opera|dillo) $browser_path $@ -- 1.8.5.3 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html