[ANNOUNCE] Sharness - Test library derived from Git
Hi, I've been wanting to announce Sharness [1] on this list for quite some time now, but never managed to do so. With the release of version 0.2.4, I think it's about time to change that. Sharness is a shell-based test harness library. It was derived from the Git project and is basically a generalized and stripped-down version of t/test-lib.sh (I basically removed all things specific to Git). So when you know how to write tests for Git, it should be very familiar. I've been using Sharness to test my command-line applications [2] for over a year now. It's especially useful when you're doing continuous integration with a service like Travis CI [3]. Development of Sharness takes place at GitHub [4]. If you're interested, there might be some things I could contribute back to Git, e.g. the API documentation [5] I wrote in TomDoc format. Looking forward to your feedback. [1] http://mlafeldt.github.com/sharness [2] https://github.com/mlafeldt/sharness#projects-using-sharness [3] http://travis-ci.org/ [4] https://github.com/mlafeldt/sharness [5] https://github.com/mlafeldt/sharness/blob/master/API.md -Mathias -- 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: [GSoC] Designing a faster index format - Progress report week 13
On 07/16, Junio C Hamano wrote: Thomas Gummerer t.gumme...@gmail.com writes: == Work done in the previous 12 weeks == - Definition of a tentative index file v5 format [1]. This differs from the proposal in making it possible to bisect the directory entries and file entries, to do a binary search. The exact bits for each section were also defined. To further compress the index, along with prefix compression, the stat data is hashed, since it's only used for comparison, but the plain data is never used. s/comparison/equality comparison/ perhaps? Exactly, thanks. Thanks to Michael Haggerty, Nguyen Thai Ngoc Duy, Thomas Rast and Robin Rosenberg for feedback. - Read the index format format and translate it to the current in s/format format/on-disk file format/ or something? Yes, thanks. memory format. This doesn't include reading any of the current extensions, which are now part of the main index. The code again is on github. [4] Thanks for reviewing the first steps to Thomas Rast. - Started implementing the writer, which extracts the directories from the in-memory format, and writes the header and the directories to disk. - I found a few bugs in the algorithm for extracting the directories and decided to completely rewrite it, using a hash table instead of simple lists, since the old one would have to many corner cases to handle. What does the algorithm refer to? Is it the one described in the previous bullet point, or is it the code in production? If latter, it would help to separate out the task to fix the breakage, as people with the current or previous versions of Git will be negatively affected until that bug is fixed. If former, I am not sure if this task needs to be described in two bullet points (I did X, X had bug so I redid X in a different way is still a single task to do X). It refers to the algorithm in the previous bullet point, which extracts the directories, and can be included in the above bullet point. Sorry for the confusion. == Work done int the last week == - Polished the patch for the ce_namelen field. The thread for the patch can be found at [5]. Thanks for this one; I think it is ready for 'next', but if you are still not satisfied I do not mind waiting for further perfection. Thanks, I'm satisfied with it, for me it can be merged to 'next'. -- 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: [GSoC] Designing a faster index format - Progress report week 13
Thanks Junio for reading the progress report, this is just corrected version without the errors that he pointed out. == Work done in the previous 12 weeks == - Definition of a tentative index file v5 format [1]. This differs from the proposal in making it possible to bisect the directory entries and file entries, to do a binary search. The exact bits for each section were also defined. To further compress the index, along with prefix compression, the stat data is hashed, since it's only used for equality comparison, but the plain data is never used. Thanks to Michael Haggerty, Nguyen Thai Ngoc Duy, Thomas Rast and Robin Rosenberg for feedback. - Prototype of a converter from the index format v2/v3 to the index format v5. [2] The converter reads the index from a git repository, can output parts of the index (header, index entries as in git ls-files --debug, cache tree as in test-dump-cache-tree, or the reuc data). Then it writes the v5 index file format to .git/index-v5. Thanks to Michael Haggerty for the code review. - Prototype of a reader for the new index file format. [3] The reader has mainly the purpose to show the algorithm used to read the index lexicographically sorted after the full name which is required by the current internal memory format. Big thanks for reviewing this code and giving me advice on refactoring goes to Michael Haggerty. - Read the on-disk index file format and translate it to the current in memory format. This doesn't include reading any of the current extensions, which are now part of the main index. The code again is on github. [4] Thanks for reviewing the first steps to Thomas Rast. - Read the cache-tree data (formerly an extension, now it's integrated with the rest of the directory data) from the new ondisk format. There are still a few optimizations to do in this algorithm. - Started implementing the API (suggested by Duy), but it's still in the very early stages. There is one commit for this on GitHub [1], but it's a very early work in progress. - Started implementing the writer, which extracts the directories from the in-memory format, and writes the header and the directories to disk. The algorithm uses a hash-table instead of a simple list, to avoid many corner cases. - Implemented writing the file block to disk, and basic tests from the test suite are running fine, not including tests that require conflicted data or the cache-tree to work, which both are not implemented yet. - Started implementing a patch to introduce a ce_namelen field in struct cache_entry and drop the name length from the flags. [5] == Work done int the last week == - Polished the patch for the ce_namelen field. The thread for the patch can be found at [5]. Again thanks to Junio, Duy and Thomas for reviewing it and giving me suggestions for improving it. - Implemented the cache-tree and conflict data writing to the index-v5 file. == Outlook for the next week == - There are still a few bugs in the conflict writing, which will be fixed, to make the test suite pass with index-v5. - Once the test suite passes, the code still needs to be refactored and optimized. - If the two points above go well, I'll continue working on the api that Duy suggested. [1] https://github.com/tgummerer/git/wiki/Index-file-format-v5 [2] https://github.com/tgummerer/git/blob/pythonprototype/git-convert-index.py [3] https://github.com/tgummerer/git/blob/pythonprototype/git-read-index-v5.py [4] https://github.com/tgummerer/git/tree/index-v5 [5] http://thread.gmane.org/gmane.comp.version-control.git/200997 -- 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: Don't share anything but those files
Hoi, On 13-07-12 16:40, Yves Perron wrote: I'm wondering how to commit only selected files/folders on GIT, if even possible. Note, the ignore list is not a good option for me as I'd like to add a few files in a folder that contains many hundreds for instance. Basically, I'm looking for a way to say, don't share anything but those files. I would use a .gitignore with something like: cat EOF .gitignore # Ignore everything * # Except !/.gitignore !/path/to/file/1 !/path/to/file/2 EOF Only the two specified files and the .gitignore file should be shown in `git status` now. Kind regards, Nick Douma signature.asc Description: OpenPGP digital signature
Re: git-p4: Jobs and skipSubmitEdit
Pete, I gave the patch a try, and it seems to work great. Only problem I realized is that it means that the git commit message and the p4 log message end up different, because to p4 the jobs lines are special and get stripped out, but in git it just stays part of the commit message. So, when you do a p4 sync/rebase, the commits come back without it. This doesn't make much of difference now, because the commit messages come back modified with the p4 path and changelist number anyway, but if Luke tries to do that change to store the p4 path/changelist in notes instead, then we wouldn't want any differences in the commit messages, because then the commits hashes won't match again. Not sure what the best thing to do here is, but I guess it doesn't matter until this mythical notes thing happens. Mike On Tue, Jun 26, 2012 at 7:21 AM, Pete Wyckoff p...@padd.com wrote: m...@horowitz.name wrote on Tue, 26 Jun 2012 01:07 -0400: Well, Jobs: is the only thing I use. Everything else is filled in automatically by git-p4. Yeah, so Jobs: appears once on a line by itself, and then multiple lines tabbed in of whatever the Job ids are, in our case they are JIRA issue numbers. So, it might look like: Jobs: PROJECTNAME-123 PROJECTNAME-456 I think that if someone is using git-p4 and they have Jobs: at the beginning of a line by itself in a git commit message, then it is safe to stop pre-pending tabs to the lines from there on. It can also be an option to turn this behavior on. I agree that it is simpler to explain if Jobs: must come last. For the option, I'd prefer not to add another one, and instead hope that it's unlikely to find such a construct in a commit message that does not want this feature to happen. I coded it up already, but with a couple little differences. Once I get a couple more of the series on which it depends mailed out, I'll send it along for you to play with. -- Pete On Sun, Jun 24, 2012 at 4:24 PM, Pete Wyckoff p...@padd.com wrote: m...@horowitz.name wrote on Fri, 22 Jun 2012 12:15 -0400: I've written a git prepare-commit-msg hook to do what the Perforce JobsView would essentially do, so I can include the jobs directly in my git commit message, and then use git-p4.skipSubmitEdit=true, so I can just push things into Perforce directly from git without ever being prompted by Perforce. Problem is that this doesn't work, because git-p4 tabs in the entire commit message to put it in the Description: section of the Perforce changelist, and my Jobs: ends up tabbed in, and it it required by Perforce to be at the beginning of the line. The submit ends up failing, because Jobs: is required. I am forced to turn off skipSubmitEdit and edit the message to remove the tab from the Jobs: line each commit. Is there any option to make this work right, or does the git-p4 not support this? This is a great idea, and something I've thought would be useful too. There's no code to handle it currently, but it shouldn't be too hard. I'm imagining that special strings in the git commit are hoisted up out of the description when building the p4 change message, as you describe. Are there any more than Jobs:? Is it just a single instance that might appear? An easy way to do this is to change prepareLogMessage to alter or add a Jobs line. Unless we decide this needs to be more general. -- Pete -- 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
git rebase -i does not rebase if all lines are removed
Make a commit on top of master. git rebase -i origin/master Remove the commit. Git prints Nothing to do and does not rebase. Running 'git rebase -i' when there are no local commits has 'noop' in the first line, and with it the rebase is successful. Why is this 'noop' mandatory? - Orgad -- 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 rebase -i does not rebase if all lines are removed
On Tue, 2012-07-17 at 13:46 +0300, Orgad and Raizel Shaneh wrote: Make a commit on top of master. git rebase -i origin/master Remove the commit. Git prints Nothing to do and does not rebase. Running 'git rebase -i' when there are no local commits has 'noop' in the first line, and with it the rebase is successful. Why is this 'noop' mandatory? If you read the instructions, the last line says # However, if you remove everything, the rebase will be aborted so if you want to do a no-op, then you need to tell it. This is the same way you abort a commit, by providing it with an empty message. But more important would be /why/ you feel that rebase -i is the tool you should be using. If you'd like to move the branch pointer back, that's what the reset command is for. rebase deals with moving commits from one base to another and optionally reordering, squashing or removing some of them. cmn -- 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: possible bug in autocompletion
On Tue, Jul 17, 2012 at 11:10:39AM +0200, Jeroen Meijer wrote: We have a tag name with some special characters. The tag name is 'Build%20V%20${bamboo.custom.jiraversion.name}%20Build%20721'. In somecases where autocompletion is used an error is given, such as 'bash: Build%20V%20${bamboo.custom.jiraversion.name}%20Build%20721: bad substitution'. This can be invoked by typing 'git checkout B' and then pressing tab. Hrm. Weird. It is the ${} in your tag name that causes the problem, and it all boils down to bash trying to do parameter expansion on the contents of compgen -W. You can see it in a much simpler example: $ echo '${foo.bar}' ;# no expansion, works ${foo.bar} $ echo ${foo.bar} ;# expansion, bash rightfully complains bash: ${foo.bar}: bad substitution $ compgen -W '${foo.bar}' f bash: ${foo.bar}: bad substitution In the final command, we use single-quotes so there is no expansion before the command execution. So it happens internally to compgen. documentation for compgen says: -W wordlist The wordlist is split using the characters in the IFS special vari‐ able as delimiters, and each resultant word is expanded. The possi‐ ble completions are the members of the resultant list which match the word being completed. Which seems kind of crazy to me. It means that we need to be quoting everything we feed to compgen to avoid accidental expansion. But I guess bash is not likely to change anytime soon, so we probably need to work around it. Of course; the tag is useless but still I guess this is a bug in the autocompletion of git. Yeah, that tag is crazy. But this can happen anywhere that we feed arbitrary data to compgen. Try this: echo content '${foo.bar}' git add . git commit git show HEAD:tab which generates the same error. Or even a file named foo$bar, which is much more likely; that will not generate an error, but it will expand $bar and produce erroneous results. I think we also have issues with files with single and double quotes in them. Something like this seems to fix it for me: diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index ffedce7..2d20824 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -261,7 +261,12 @@ __gitcomp () __gitcomp_nl () { local IFS=$'\n' - COMPREPLY=($(compgen -P ${2-} -S ${4- } -W $1 -- ${3-$cur})) + local words=$1 + words=${words//\\/} + words=${words//\$/\\\$} + words=${words//\'/\\\'} + words=${words//\/\\\} + COMPREPLY=($(compgen -P ${2-} -S ${4- } -W $words -- ${3-$cur})) } __git_heads () but it is awfully ugly. Maybe completion experts can offer a better solution. -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git rebase -i does not rebase if all lines are removed
Am 7/17/2012 12:55, schrieb Carlos Martín Nieto: But more important would be /why/ you feel that rebase -i is the tool you should be using. If you'd like to move the branch pointer back, that's what the reset command is for. Perhaps because that's not what the OP wanted to do? Sometimes it happens that you rebase a bunch of commits, and only a handful remains because the others are already in upstream. Looking at each remaining one closely, you decide that they don't have to be rebased (maybe because slightly modified versions are in upstream), so you remove them one by one, and you end up with an empty list. This has happened to me at one point, and writing noop after the list is empty is a minor nuisance. But I am not complaining. Because being able to abort an interactive rebase by clearing the list is much more important. -- Hannes -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix overwritten remote ref on with fast-import.
Florian Achleitner wrote: On Monday 16 July 2012 22:27:25 Jonathan Nieder wrote: Hm, that still doesn't look right. The RHS of the refspec is supposed to be a _private_ namespace for the remote helper, and refs/remotes/ is not private. [...] remote-svn now uses get_fetch_map to retrieve the local refs. So it respects the fetch refspec in the config. No no no no no. That's transport-helper's job. The RHS of the remote helper's refspec really is supposed to be _private_. Improvements to the documentation to clarify this would be welcome. Thanks, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] git-remote-mediawiki: two more fixes
These patches can be added to branch mm/mediawiki-usability in pu. For the curious: I originally had patch 2/2 in my serie, but mistakenly discarded it during a rebase. While recovering it and testing it, I found a typo fixed by patch 1/2. Matthieu Moy (2): git-remote-mediawiki: fix incorrect test usage in test git-remote-mediawiki: allow page names with a ':' contrib/mw-to-git/git-remote-mediawiki | 49 +++-- contrib/mw-to-git/t/push-pull-tests.sh | 2 +- contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh | 20 3 files changed, 54 insertions(+), 17 deletions(-) -- 1.7.11.2.258.g5ff3cdf.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 2/2] git-remote-mediawiki: allow page names with a ':'
Traditionnally, pages named Foo:Bar are page 'Bar' in namespace 'Foo'. However, it is also possible to call a page Foo:Bar if 'Foo' is not a namespace. In this case, the actual name of the page is 'Foo:Bar', in the main namespace. Since we can't tell with only the filename, query the wiki for a namespace 'Foo' in these cases, but deal with the case where no such namespace is found. Signed-off-by: Matthieu Moy matthieu@imag.fr --- contrib/mw-to-git/git-remote-mediawiki | 49 +++-- contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh | 20 2 files changed, 53 insertions(+), 16 deletions(-) diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki index d6be188..47d4878 100755 --- a/contrib/mw-to-git/git-remote-mediawiki +++ b/contrib/mw-to-git/git-remote-mediawiki @@ -955,8 +955,11 @@ sub mw_import_revids { # Differentiates classic pages and media files. my ($namespace, $filename) = $page_title =~ /^([^:]*):(.*)$/; my %mediafile; - if ($namespace get_mw_namespace_id($namespace) == get_mw_namespace_id(File)) { - %mediafile = get_mw_mediafile_for_page_revision($filename, $rev-{timestamp}); + if ($namespace) { + my $id = get_mw_namespace_id($namespace); + if ($id $id == get_mw_namespace_id(File)) { + %mediafile = get_mw_mediafile_for_page_revision($filename, $rev-{timestamp}); + } } # If this is a revision of the media page for new version # of a file do one common commit for both file and media page. @@ -1306,7 +1309,11 @@ sub get_mw_namespace_id { chomp(@temp); foreach my $ns (@temp) { my ($n, $id) = split(/:/, $ns); - $namespace_id{$n} = $id; + if ($id eq 'notANameSpace') { + $namespace_id{$n} = {is_namespace = 0}; + } else { + $namespace_id{$n} = {is_namespace = 1, id = $id}; + } $cached_mw_namespace_id{$n} = 1; } } @@ -1324,28 +1331,38 @@ sub get_mw_namespace_id { while (my ($id, $ns) = each(%{$result-{query}-{namespaces}})) { if (defined($ns-{id}) defined($ns-{canonical})) { - $namespace_id{$ns-{canonical}} = $ns-{id}; + $namespace_id{$ns-{canonical}} = {is_namespace = 1, id = $ns-{id}}; if ($ns-{'*'}) { # alias (e.g. french Fichier: as alias for canonical File:) - $namespace_id{$ns-{'*'}} = $ns-{id}; + $namespace_id{$ns-{'*'}} = {is_namespace = 1, id = $ns-{id}}; } } } } - my $id = $namespace_id{$name}; + my $ns = $namespace_id{$name}; + my $id; - if (defined $id) { - # Store explicitely requested namespaces on disk - if (!exists $cached_mw_namespace_id{$name}) { - run_git(config --add remote.. $remotename - ..namespaceCache \. $name .:. $id .\); - $cached_mw_namespace_id{$name} = 1; - } - return $id; - } else { - die No such namespace $name on MediaWiki.; + unless (defined $ns) { + print STDERR No such namespace $name on MediaWiki.\n; + $ns = {is_namespace = 0}; + $namespace_id{$name} = $ns; + } + + if ($ns-{is_namespace}) { + $id = $ns-{id}; + } + + # Store notANameSpace as special value for inexisting namespaces + my $store_id = ($id || 'notANameSpace'); + + # Store explicitely requested namespaces on disk + if (!exists $cached_mw_namespace_id{$name}) { + run_git(config --add remote.. $remotename + ..namespaceCache \. $name .:. $store_id .\); + $cached_mw_namespace_id{$name} = 1; } + return $id; } sub get_mw_namespace_id_for_page { diff --git a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh index 8635878..246d47d 100755 --- a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh +++ b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh @@ -169,6 +169,26 @@ test_expect_failure 'special character at the begining of file name from mw to g test_path_is_file mw_dir_11/[char_2 ' +test_expect_success 'Pull page with title containing : other than namespace separator' ' + wiki_editpage Foo:Bar content false + ( +
[PATCH 1/2] git-remote-mediawiki: fix incorrect test usage in test
Signed-off-by: Matthieu Moy matthieu@imag.fr --- contrib/mw-to-git/t/push-pull-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/mw-to-git/t/push-pull-tests.sh b/contrib/mw-to-git/t/push-pull-tests.sh index 6692a0f..9da2dc5 100644 --- a/contrib/mw-to-git/t/push-pull-tests.sh +++ b/contrib/mw-to-git/t/push-pull-tests.sh @@ -104,7 +104,7 @@ test_push_pull () { git push ) - test ! wiki_page_exist Foo + test_must_fail wiki_page_exist Foo ' test_expect_success 'Merge conflict expected and solving it' ' -- 1.7.11.2.258.g5ff3cdf.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] Add explanatory comment for transport-helpers refs mapping.
Hi, Florian Achleitner wrote: --- a/transport-helper.c +++ b/transport-helper.c @@ -484,8 +484,18 @@ static int fetch_with_import(struct transport *transport, if (posn-status REF_STATUS_UPTODATE) continue; if (data-refspecs) + /* + * If the remote-helper advertised the refpec capability, we + * retrieve the local, private ref from it. The imported data is + * expected there. (see Documentation/git-remote-helpers.*). + */ private = apply_refspecs(data-refspecs, data-refspec_nr, posn- name); else + /* + * else, the default refspec *:* is implied. The remote-helper has + * to import the remote heads directly to the local heads. + * remote-helpers using 'import' should have the refspec capability. + */ private = xstrdup(posn-name); What is _exactly_ the information the reader would want to know here? Looking at this code: char *private; posn = to_fetch[i]; if (posn-status REF_STATUS_UPTODATE) continue; if (!data-refspecs) private = xstrdup(...); else private = apply_refspecs(...); if (!private) continue; read_ref(private, posn-old_sha1); free(private); Despite the misleading old_sha1 name, this loop runs after fast-import has finished, and the values being read into to_fetch[]::old_sha1 are object names representing the result. Callers such as builtin/fetch.c then use these values to write feedback to the terminal, to populate FETCH_HEAD, and to determine what new value peer_ref should get. Shouldn't the comment say something about these SHA-1s not actually being old? Something like: /* * If the remote helper advertised the refspec capability, * it will have the written result of the import to the refs * named on the right hand side of the first refspec matching * each ref we were fetching. * * (If no refspec capability was specified, for historical * reasons we default to *:*.) * * Store the result in to_fetch[i].old_sha1. Callers such * as git fetch can use the value to write feedback to the * terminal, populate FETCH_HEAD, and determine what new value * should be written to peer_ref if the update is a * fast-forward or this is a forced update. */ for (i = 0; ... Hmm? Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable
The tests in: t/t1306-xdg-files.sh were failing because the git commands were using the environment variable `XDG_CONFIG_HOME' as it was set for the user's usual environment, rather than as set for the testing environment. This commit provides the quickest, simplest hack to make things work; because there is already the setting and exporting of the environment variable `HOME' in: t/test-lib.sh this commit simply adds to that file the setting and exporting of the variable `XDG_CONFIG_HOME' (based on the variable `HOME' that is provided there). However, the existing tests [sometimes] don't use these variables explicitly, so the whole structure of this testing rests on the hope that people maintain the conventions captured by the values of these variables; another commit should fix this instability by using these variables explicitly. (Note: Double quotes are not needed around the value assigned to the variable, as word splitting is not performed). Signed-off-by: Michael Witten mfwit...@gmail.com --- t/test-lib.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/test-lib.sh b/t/test-lib.sh index acda33d..69bcc75 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -544,6 +544,9 @@ rm -fr $test || { HOME=$TRASH_DIRECTORY export HOME +XDG_CONFIG_HOME=$HOME/.config +export XDG_CONFIG_HOME + if test -z $TEST_NO_CREATE_REPO; then test_create_repo $test else -- 1.7.11.1.29.gf71be5c -- 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: Fix git-svn tests for SVN 1.7.5.
Hi! Michael G Schwern wrote: I've fixed the git-svn tests for SVN 1.7 and tested with SVN 1.7.5. Thanks. git-svn is not maintained by Junio but by Eric and others on the list. I'm cc-ing Eric and Ben Walton so they can benefit from your work. SVN 1.7 changed its expectations of path and URL formats and git-svn did not comply with them. The new code uses SVN's own canonicalization routines where available. This has been reported in several places... https://bugs.gentoo.org/show_bug.cgi?id=418431 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=678764 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=661094 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=678137 https://trac.macports.org/ticket/32753 It also split the internal classes out of git-svn.perl and into their own modules in perl/Git/ to make them easier to work on. They compile alone, but remain heavily intertwined with each other and git-svn. I didn't want to go very far down that rabbit hole. This makes the tests pass, but I'm pretty sure plenty of canonicalization problems remain untested. Hopefully by attacking the problem at the root (ie. in the Git::SVN and Git::SVN::Ra accessors) it will wipe out a range of problems. t9100-git-svn-basic.sh tests 11-13 continue to fail for what look like unrelated reasons to do with SVN and symlinks. There's a lot of work in this change, so I felt it better to submit the patches as a link to a git repository rather than attach a pile of patches. Here is my repository, the work is in the fix-canonical branch. https://github.com/schwern/git It is indeed quite the intimidating pile of patches, so I do not think we will be able to apply it all in one chunk as-is. :( My advice would be to send five or so of the patches that you would like to be reviewed first, inline, one per message, in reply to this message so we can start to work on that. Presumably the patches do not regress git-svn's behavior but only make it saner, so even if this is not a complete fix it should allow us to get started. See Documentation/SubmittingPatches for more hints. Thanks and hope that helps, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] Testing: XDG config files: Use $HOME and $XDG_CONFIG_HOME explicitly
The tests in: t/t1306-xdg-files.sh relied on brittle conventions: * $HOME and $XDG_CONFIG_HOME having certain values. * The testing commands having a certain current working directory; at least one test failed as a result. This commit mitigates the problem by using the variables $HOME and $XDG_CONFIG_HOME explicitly. Signed-off-by: Michael Witten mfwit...@gmail.com --- t/t1306-xdg-files.sh | 69 +++- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh index 3c75c3f..2327047 100755 --- a/t/t1306-xdg-files.sh +++ b/t/t1306-xdg-files.sh @@ -9,58 +9,60 @@ test_description='Compatibility with $XDG_CONFIG_HOME/git/ files' . ./test-lib.sh +GIT_CONFIG_DIR=$XDG_CONFIG_HOME/git + -test_expect_success 'read config: xdg file exists and ~/.gitconfig doesn'\''t' ' +test_expect_success 'read config: xdg file exists and $HOME/.gitconfig doesn'\''t' ' - mkdir -p .config/git + mkdir -p $GIT_CONFIG_DIR - echo [alias] .config/git/config + echo [alias] $GIT_CONFIG_DIR/config - echo myalias = !echo in_config .config/git/config + echo myalias = !echo in_config $GIT_CONFIG_DIR/config echo in_config expected git myalias actual test_cmp expected actual ' -test_expect_success 'read config: xdg file exists and ~/.gitconfig exists' ' +test_expect_success 'read config: xdg file exists and $HOME/.gitconfig exists' ' - .gitconfig + $HOME/.gitconfig - echo [alias] .gitconfig + echo [alias] $HOME/.gitconfig - echo myalias = !echo in_gitconfig .gitconfig + echo myalias = !echo in_gitconfig $HOME/.gitconfig echo in_gitconfig expected git myalias actual test_cmp expected actual ' -test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\''t' ' +test_expect_success 'read with --get: xdg file exists and $HOME/.gitconfig doesn'\''t' ' - rm .gitconfig + rm $HOME/.gitconfig - echo [user] .config/git/config + echo [user] $GIT_CONFIG_DIR/config - echo name = read_config .config/git/config + echo name = read_config $GIT_CONFIG_DIR/config echo read_config expected git config --get user.name actual test_cmp expected actual ' -test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' ' +test_expect_success 'read with --get: xdg file exists and $HOME/.gitconfig exists' ' - .gitconfig + $HOME/.gitconfig - echo [user] .gitconfig + echo [user] $HOME/.gitconfig - echo name = read_gitconfig .gitconfig + echo name = read_gitconfig $HOME/.gitconfig echo read_gitconfig expected git config --get user.name actual test_cmp expected actual ' -test_expect_success 'read with --list: xdg file exists and ~/.gitconfig doesn'\''t' ' +test_expect_success 'read with --list: xdg file exists and $HOME/.gitconfig doesn'\''t' ' - rm .gitconfig + rm $HOME/.gitconfig echo user.name=read_config expected git config --global --list actual test_cmp expected actual ' -test_expect_success 'read with --list: xdg file exists and ~/.gitconfig exists' ' +test_expect_success 'read with --list: xdg file exists and $HOME/.gitconfig exists' ' - .gitconfig + $HOME/.gitconfig - echo [user] .gitconfig + echo [user] $HOME/.gitconfig - echo name = read_gitconfig .gitconfig + echo name = read_gitconfig $HOME/.gitconfig echo user.name=read_gitconfig expected git config --global --list actual test_cmp expected actual @@ -75,8 +77,8 @@ test_expect_success 'Setup' ' test_expect_success 'Exclusion of a file in the XDG ignore file' ' - mkdir -p $HOME/.config/git/ + mkdir -p $GIT_CONFIG_DIR - echo to_be_excluded $HOME/.config/git/ignore + echo to_be_excluded $GIT_CONFIG_DIR/ignore test_must_fail git add to_be_excluded ' @@ -89,7 +91,7 @@ test_expect_success 'Exclusion in both XDG and local ignore files' ' test_expect_success 'Exclusion in a non-XDG global ignore file' ' rm .gitignore - echo $HOME/.config/git/ignore + echo $GIT_CONFIG_DIR/ignore echo to_be_excluded $HOME/my_gitignore git config core.excludesfile $HOME/my_gitignore test_must_fail git add to_be_excluded @@ -100,7 +102,7 @@ test_expect_success 'Checking attributes in the XDG attributes file' ' echo foo f git check-attr -a f actual test_line_count -eq 0 actual - echo f attr_f $HOME/.config/git/attributes + echo f attr_f $GIT_CONFIG_DIR/attributes echo f: attr_f: set expected git check-attr -a f actual test_cmp expected actual @@ -125,18 +127,18 @@ test_expect_success 'Checking attributes
[PATCH 3/3] Testing: XDG config files: Trivial: `xdg' - `XDG'
For the sake of consistency and correctness, the acronymn `xdg' has been capitalized (`XDG'). Signed-off-by: Michael Witten mfwit...@gmail.com --- t/t1306-xdg-files.sh | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh index 2327047..6a3ab09 100755 --- a/t/t1306-xdg-files.sh +++ b/t/t1306-xdg-files.sh @@ -11,7 +11,7 @@ GIT_CONFIG_DIR=$XDG_CONFIG_HOME/git -test_expect_success 'read config: xdg file exists and $HOME/.gitconfig doesn'\''t' ' +test_expect_success 'read config: XDG file exists and $HOME/.gitconfig doesn'\''t' ' mkdir -p $GIT_CONFIG_DIR echo [alias] $GIT_CONFIG_DIR/config echo myalias = !echo in_config $GIT_CONFIG_DIR/config @@ -21,7 +21,7 @@ ' -test_expect_success 'read config: xdg file exists and $HOME/.gitconfig exists' ' +test_expect_success 'read config: XDG file exists and $HOME/.gitconfig exists' ' $HOME/.gitconfig echo [alias] $HOME/.gitconfig echo myalias = !echo in_gitconfig $HOME/.gitconfig @@ -31,7 +31,7 @@ ' -test_expect_success 'read with --get: xdg file exists and $HOME/.gitconfig doesn'\''t' ' +test_expect_success 'read with --get: XDG file exists and $HOME/.gitconfig doesn'\''t' ' rm $HOME/.gitconfig echo [user] $GIT_CONFIG_DIR/config echo name = read_config $GIT_CONFIG_DIR/config @@ -41,7 +41,7 @@ ' -test_expect_success 'read with --get: xdg file exists and $HOME/.gitconfig exists' ' +test_expect_success 'read with --get: XDG file exists and $HOME/.gitconfig exists' ' $HOME/.gitconfig echo [user] $HOME/.gitconfig echo name = read_gitconfig $HOME/.gitconfig @@ -51,7 +51,7 @@ ' -test_expect_success 'read with --list: xdg file exists and $HOME/.gitconfig doesn'\''t' ' +test_expect_success 'read with --list: XDG file exists and $HOME/.gitconfig doesn'\''t' ' rm $HOME/.gitconfig echo user.name=read_config expected git config --global --list actual @@ -59,7 +59,7 @@ ' -test_expect_success 'read with --list: xdg file exists and $HOME/.gitconfig exists' ' +test_expect_success 'read with --list: XDG file exists and $HOME/.gitconfig exists' ' $HOME/.gitconfig echo [user] $HOME/.gitconfig echo name = read_gitconfig $HOME/.gitconfig @@ -127,7 +127,7 @@ ' -test_expect_success 'write: xdg file exists and $HOME/.gitconfig doesn'\''t' ' +test_expect_success 'write: XDG file exists and $HOME/.gitconfig doesn'\''t' ' mkdir -p $GIT_CONFIG_DIR $GIT_CONFIG_DIR/config test_might_fail rm $HOME/.gitconfig @@ -138,7 +138,7 @@ ' -test_expect_success 'write: xdg file exists and $HOME/.gitconfig exists' ' +test_expect_success 'write: XDG file exists and $HOME/.gitconfig exists' ' $HOME/.gitconfig git config --global user.name write_gitconfig echo [user] expected -- 1.7.11.1.29.gf71be5c -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable
Hi, Michael Witten wrote: --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -544,6 +544,9 @@ rm -fr $test || { HOME=$TRASH_DIRECTORY export HOME +XDG_CONFIG_HOME=$HOME/.config +export XDG_CONFIG_HOME + I think this is a bad idea. The typical case is for XDG_CONFIG_HOME not to be set, and we need to make sure git works well in the typical case. But the general idea seems sane --- how about unset VISUAL EMAIL LANGUAGE COLUMNS XDG_CONFIG_HOME $(perl -e ' ... ? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable
Michael Witten mfwit...@gmail.com writes: --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -544,6 +544,9 @@ rm -fr $test || { HOME=$TRASH_DIRECTORY export HOME +XDG_CONFIG_HOME=$HOME/.config +export XDG_CONFIG_HOME + Why not just unset XDG_CONFIG_HOME? Your match makes it look like XDG_CONFIG_HOME is required to use the configuration directory, but it is not. To me, the main feature is the ability to use $HOME/.config/git/ as a configuration directory (this is not just a convention, this is a documented feature), and the management of the variable $XDG_CONFIG_HOME is just a bonnus. Before your patches, the correct management of $XDG_CONFIG_HOME to override $HOME/.config/git/ was untested (which is unfortunate, indeed), but after your patch serie, the fact that the default is $HOME/.config/git/ is untested, which IMHO is even worse. Unsetting XDG_CONFIG_HOME and adding one test like this would be better IMHO. diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh index 3c75c3f..f1ea9f1 100755 --- a/t/t1306-xdg-files.sh +++ b/t/t1306-xdg-files.sh @@ -38,6 +38,19 @@ test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\'' test_cmp expected actual ' +test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/git' ' + mkdir -p $HOME/xdg/git/ + echo [user] $HOME/xdg/git/config + echo name = in_xdg $HOME/xdg/git/config + echo in_xdg expected + ( + XDG_CONFIG_HOME=$HOME/xdg/ + export XDG_CONFIG_HOME + git config --get-all user.name actual + ) + test_cmp expected actual +' + test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' ' .gitconfig -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] Testing: XDG config files: Use $HOME and $XDG_CONFIG_HOME explicitly
Michael Witten mfwit...@gmail.com writes: The tests in: t/t1306-xdg-files.sh relied on brittle conventions: * $HOME and $XDG_CONFIG_HOME having certain values. * The testing commands having a certain current working directory; Other tests (t1305-config-include.sh at least) use the fact that the tests are ran in $HOME. I'm not sure if we want to change that. About XDG_CONFIG_HOME, the tests were just assuming it was unset. +GIT_CONFIG_DIR=$XDG_CONFIG_HOME/git As I said in my earlier message, I'd rather test the default value ($HOME/.config/git) than the particular case whe $XDG_CONFIG_HOME is set. -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable
Matthieu Moy matthieu@grenoble-inp.fr writes: Before your patches, the correct management of $XDG_CONFIG_HOME to override $HOME/.config/git/ was untested (which is unfortunate, indeed), but after your patch serie, the fact that the default is $HOME/.config/git/ is untested, which IMHO is even worse. Unsetting XDG_CONFIG_HOME and adding one test like this would be better IMHO. Absolutely. We would want to make sure that the new code does not interfere with established uses when the user does not ask for the new feature (i.e. XDG not set), and also make sure it does what it was meant to do when the feature is called for (i.e. XDG set). It might be true that the set of tests in the series did not test the full spectrum of the latter, but then we would want to see the gap filled by adding missing tests, not by converting tests for former into the ones that test for the latter. Even with the patch below there may be other gaps in the test. For example, core.excludesfile and core.attributesfile must default to the XDG location when they exist, whether these variables are set; we may want to make sure that is not broken in the future. Michael, could you change the direction of the patch and look into filling such gaps? Thanks. diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh index 3c75c3f..f1ea9f1 100755 --- a/t/t1306-xdg-files.sh +++ b/t/t1306-xdg-files.sh @@ -38,6 +38,19 @@ test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\'' test_cmp expected actual ' +test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/git' ' + mkdir -p $HOME/xdg/git/ + echo [user] $HOME/xdg/git/config + echo name = in_xdg $HOME/xdg/git/config + echo in_xdg expected + ( + XDG_CONFIG_HOME=$HOME/xdg/ + export XDG_CONFIG_HOME + git config --get-all user.name actual + ) + test_cmp expected actual +' + test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' ' .gitconfig -- 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: [ANNOUNCE] Sharness - Test library derived from Git
On Tue, Jul 17, 2012 at 10:06 AM, Mathias Lafeldt mathias.lafe...@gmail.com wrote: I've been wanting to announce Sharness [1] on this list for quite some time now, but never managed to do so. With the release of version 0.2.4, I think it's about time to change that. Sharness is a shell-based test harness library. It was derived from the Git project and is basically a generalized and stripped-down version of t/test-lib.sh (I basically removed all things specific to Git). So when you know how to write tests for Git, it should be very familiar. Nice, I thought about doing something like this myself but never had the time. Perhaps to avoid duplication we could move to this and keep Git-specific function in some other file. Do you think that would be sensible, and would you be willing to submit patches for that? -- 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: Fix git-svn tests for SVN 1.7.5.
On 2012.7.17 10:44 AM, Jonathan Nieder wrote: Michael G Schwern wrote: I've fixed the git-svn tests for SVN 1.7 and tested with SVN 1.7.5. Thanks. git-svn is not maintained by Junio but by Eric and others on the list. I'm cc-ing Eric and Ben Walton so they can benefit from your work. Thanks. There's a lot of work in this change, so I felt it better to submit the patches as a link to a git repository rather than attach a pile of patches. Here is my repository, the work is in the fix-canonical branch. https://github.com/schwern/git It is indeed quite the intimidating pile of patches, so I do not think we will be able to apply it all in one chunk as-is. :( My advice would be to send five or so of the patches that you would like to be reviewed first, inline, one per message, in reply to this message so we can start to work on that. Presumably the patches do not regress git-svn's behavior but only make it saner, so even if this is not a complete fix it should allow us to get started. See Documentation/SubmittingPatches for more hints. Yes, the refactorings are all as rote as I could make them and only lightly touch the code enough to make the canonicalization possible... with a bit more work than was strictly necessary around the Perl build system. Let me do a bit of rebase work to make things work better as a series of submissions and I'll get back to you. I'm new here, and I'll play nice, but let me go on record to state that Git asking for individual emails with inline patches feels like Sendmail Corp asking to be faxed an email thread. I was kinda hoping SubmittingPatches wasn't serious about that and it was some sort of policy artifact that was never updated. :-/ -- 151. The proper way to report to my Commander is Specialist Schwarz, reporting as ordered, Sir not You can't prove a thing! -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/ -- 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] commit-tree: resurrect command line parsing updates
79a9312 (commit-tree: update the command line parsing, 2011-11-09) updated the command line parser to understand the usual flags first and then non-flag arguments order, in addition to the original and a bit unusual tree comes first and then zero or more -p parent. Unfortunately, ba3c69a (commit: teach --gpg-sign option, 2011-10-05) broke it by mistake. Resurrect it, and protect the feature with a test from future breakages. Noticed by Keshav Kini keshav.k...@gmail.com Signed-off-by: Junio C Hamano gits...@pobox.com --- * I privately received a patch that is essentially the same from Keshav, but I do not see it either on the list or on gmane. I suspect the message was sent via gmane's news submission interface and probably it is taking some time propagating back to the list, or something. The patch in this message is with an updated log message and an additional test. It is meant to apply to the 1.7.9.X maintenance track and upwards. For 1.7.11.1 and later, we also need to revert d284367 (git-commit-tree(1): update synopsis, 2012-06-19), which was done without realizing that the updated command line argument order was lost by an earlier mistake. builtin/commit-tree.c | 3 --- t/t1100-commit-tree-options.sh | 17 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index d5e19af..792670a 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -48,9 +48,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) if (argc 2 || !strcmp(argv[1], -h)) usage(commit_tree_usage); - if (get_sha1(argv[1], tree_sha1)) - die(Not a valid object name %s, argv[1]); - for (i = 1; i argc; i++) { const char *arg = argv[i]; if (!strcmp(arg, -p)) { diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh index c4414ff..a3b7723 100755 --- a/t/t1100-commit-tree-options.sh +++ b/t/t1100-commit-tree-options.sh @@ -7,6 +7,9 @@ test_description='git commit-tree options test This test checks that git commit-tree can create a specific commit object by defining all environment variables that it understands. + +Also make sure that command line parser understands the normal +flags first and then non flag arguments command line. ' . ./test-lib.sh @@ -42,4 +45,18 @@ test_expect_success \ 'compare commit' \ 'test_cmp expected commit' + +test_expect_success 'flags and then non flags' ' + echo comment text | + git commit-tree $(cat treeid) commitid + echo comment text | + git commit-tree $(cat treeid) -p $(cat commitid) childid-1 + echo comment text | + git commit-tree -p $(cat commitid) $(cat treeid) childid-2 + test_cmp childid-1 childid-2 + git commit-tree $(cat treeid) -m foo childid-3 + git commit-tree -m foo $(cat treeid) childid-4 + test_cmp childid-3 childid-4 +' + test_done -- 1.7.11.2.308.gd5eadba -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix overwritten remote ref on with fast-import.
On Tuesday 17 July 2012 08:48:20 Jonathan Nieder wrote: Florian Achleitner wrote: On Monday 16 July 2012 22:27:25 Jonathan Nieder wrote: Hm, that still doesn't look right. The RHS of the refspec is supposed to be a _private_ namespace for the remote helper, and refs/remotes/ is not private. [...] remote-svn now uses get_fetch_map to retrieve the local refs. So it respects the fetch refspec in the config. No no no no no. That's transport-helper's job. The RHS of the remote helper's refspec really is supposed to be _private_. Improvements to the documentation to clarify this would be welcome. So we want the transport-helper to touch only private refs, i.e. some subdir of refs/, ok. On the other hand I thought we expect git-fetch to update the RHS of the passed refspec (or the default one ). How? Btw, whats FETCH_HEAD for? Thanks, Jonathan Thanks, Florian -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix overwritten remote ref on with fast-import.
Hi, Florian Achleitner wrote: So we want the transport-helper to touch only private refs, i.e. some subdir of refs/, ok. On the other hand I thought we expect git-fetch to update the RHS of the passed refspec (or the default one ). How? Now I am getting confused by terminology. By the transport-helper do you mean the remote helper (e.g., git-remote-svn) or transport-helper.c? By the default refspec do you mean the one specified in .git/config or some default when none is specified there? git fetch updates refs according to the specified fetch refspec in builtin/fetch.c::store_updated_refs(). Btw, whats FETCH_HEAD for? grep FETCH_HEAD Documentation/*.txt gives some hints. Most notably: git-fetch(1) The ref names and their object names of fetched refs are stored in .git/FETCH_HEAD. This information is left for a later merge operation done by 'git merge'. gittutorial(7) -- Alice can peek at what Bob did without merging first, using the fetch command; this allows Alice to inspect what Bob did, using a special symbol FETCH_HEAD, in order to determine if he has anything worth pulling, like this: alice$ git fetch /home/bob/myrepo master alice$ git log -p HEAD..FETCH_HEAD Hope that helps, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Extract Git classes from git-svn (2/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From 683a230e439f1d5ac2727ce4c2a74e93804fc72b Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Wed, 11 Jul 2012 22:16:01 -0700 Subject: [PATCH 03/11] Fix Git::SVN so it can at least compile alone. It's still very intertwined with git-svn, but that's a lot of work. This gets things working and tests passing again (as well as they were). This required some parallel refactorings... * fatal() moved out of git-svn into a new Git::SVN::Utils * The $can_compress lexical moved into Git::SVN::Utils::can_compress() * The $_prefix variable which stores the --prefix option is wrapped in a function (rather than made global) so access to it can be controlled. Git::SVN does not rely on this function being available so it can work without git-svn loaded. In general, the options should be put back together into a hash and accessed via an options() function. * A new tree of unit tests for the Git::SVN modules has been created. It doesn't work with the existing Makefile, that can be worried about later. * Move initialization of Git::SVN globals into Git::SVN * Have Git::SVN load the Git command* functions on its own --- git-svn.perl | 33 ++--- perl/Git/SVN.pm| 29 - perl/Git/SVN/Utils.pm | 19 +++ perl/Makefile | 2 ++ t/Git-SVN/00compile.t | 9 + t/Git-SVN/Utils/can_compress.t | 11 +++ t/Git-SVN/Utils/fatal.t| 34 ++ 7 files changed, 113 insertions(+), 24 deletions(-) create mode 100644 perl/Git/SVN/Utils.pm create mode 100644 t/Git-SVN/00compile.t create mode 100644 t/Git-SVN/Utils/can_compress.t create mode 100644 t/Git-SVN/Utils/fatal.t diff --git a/git-svn.perl b/git-svn.perl index 59db0a4..8a02d1c 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -10,6 +10,9 @@ use vars qw/ $AUTHOR $VERSION $AUTHOR = 'Eric Wong normalper...@yhbt.net'; $VERSION = '@@GIT_VERSION@@'; +use Git::SVN; +use Git::SVN::Utils qw(fatal can_compress); + # From which subdir have we been invoked? my $cmd_dir_prefix = eval { command_oneline([qw/rev-parse --show-prefix/], STDERR = 0) @@ -17,10 +20,8 @@ my $cmd_dir_prefix = eval { my $git_dir_user_set = 1 if defined $ENV{GIT_DIR}; $ENV{GIT_DIR} ||= '.git'; -$Git::SVN::default_repo_id = 'svn'; -$Git::SVN::default_ref_id = $ENV{GIT_SVN_ID} || 'git-svn'; + $Git::SVN::Ra::_log_window_size = 100; -$Git::SVN::_minimize_url = 'unset'; if (! exists $ENV{SVN_SSH} exists $ENV{GIT_SSH}) { $ENV{SVN_SSH} = $ENV{GIT_SSH}; @@ -35,8 +36,6 @@ $Git::SVN::Log::TZ = $ENV{TZ}; $ENV{TZ} = 'UTC'; $| = 1; # unbuffer STDOUT -sub fatal (@) { print STDERR @_\n; exit 1 } - # All SVN commands do it. Otherwise we may die on SIGPIPE when the remote # repository decides to close the connection which we expect to be kept alive. $SIG{PIPE} = 'IGNORE'; @@ -66,7 +65,7 @@ sub _req_svn { fatal Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION); } } -my $can_compress = eval { require Compress::Zlib; 1}; + use Carp qw/croak/; use Digest::MD5; use IO::File qw//; @@ -89,7 +88,7 @@ BEGIN { foreach (qw/command command_oneline command_noisy command_output_pipe command_input_pipe command_close_pipe command_bidi_pipe command_close_bidi_pipe/) { - for my $package ( qw(Git::SVN::Migration Git::SVN::Log Git::SVN), + for my $package ( qw(Git::SVN::Migration Git::SVN::Log), __PACKAGE__) { *{${package}::$_} = \{Git::$_}; } @@ -109,7 +108,10 @@ my ($_stdin, $_help, $_edit, $_merge, $_strategy, $_preserve_merges, $_dry_run, $_local, $_prefix, $_no_checkout, $_url, $_verbose, $_git_format, $_commit_url, $_tag, $_merge_info, $_interactive); -$Git::SVN::_follow_parent = 1; + +# This is a refactoring artifact so Git::SVN can get at this variable. +sub opt_prefix { return $_prefix || '' } + $Git::SVN::Fetcher::_placeholder_filename = .gitignore; $_q ||= 0; my %remote_opts = ( 'username=s' = \$Git::SVN::Prompt::_username, @@ -1578,7 +1580,7 @@ sub cmd_reset { } sub cmd_gc { - if (!$can_compress) { + if (!can_compress()) { warn Compress::Zlib could not be found; unhandled.log . files will not be compressed.\n; } @@ -2020,7 +2022,7 @@ sub md5sum { } sub gc_directory { - if ($can_compress -f $_ basename($_) eq unhandled.log) { + if (can_compress() -f $_ basename($_) eq unhandled.log) { my $out_filename = $_ . .gz; open my $in_fh, , $_ or die Unable to open $_: $!\n; binmode $in_fh; @@ -2042,6 +2044,7 @@ sub gc_directory { package Git::SVN::Log; use strict; use warnings; +use Git::SVN::Utils qw(fatal); use POSIX qw/strftime/; use constant
Extract Git classes from git-svn (3/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From 5f0b609e9b0a70c86c46b48f0b180c96c3355a14 Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Tue, 17 Jul 2012 15:40:03 -0700 Subject: [PATCH 04/11] Extract Git::SVN::Log from git-svn. This is a straight cut paste. Next commit will make it work. This will make it easier to see the differences in Git::SVN::Log. --- git-svn.perl| 387 --- perl/Git/SVN/Log.pm | 388 2 files changed, 388 insertions(+), 387 deletions(-) create mode 100644 perl/Git/SVN/Log.pm diff --git a/git-svn.perl b/git-svn.perl index 8a02d1c..5e6e3b5 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2041,393 +2041,6 @@ sub gc_directory { } -package Git::SVN::Log; -use strict; -use warnings; -use Git::SVN::Utils qw(fatal); -use POSIX qw/strftime/; -use constant commit_log_separator = ('-' x 72) . \n; -use vars qw/$TZ $limit $color $pager $non_recursive $verbose $oneline -%rusers $show_commit $incremental/; -my $l_fmt; - -sub cmt_showable { - my ($c) = @_; - return 1 if defined $c-{r}; - - # big commit message got truncated by the 16k pretty buffer in rev-list - if ($c-{l} $c-{l}-[-1] eq ...\n - $c-{a_raw} =~ /\@([a-f\d\-]+)$/) { - @{$c-{l}} = (); - my @log = command(qw/cat-file commit/, $c-{c}); - - # shift off the headers - shift @log while ($log[0] ne ''); - shift @log; - - # TODO: make $c-{l} not have a trailing newline in the future - @{$c-{l}} = map { $_\n } grep !/^git-svn-id: /, @log; - - (undef, $c-{r}, undef) = ::extract_metadata( - (grep(/^git-svn-id: /, @log))[-1]); - } - return defined $c-{r}; -} - -sub log_use_color { - return $color || Git-repository-get_colorbool('color.diff'); -} - -sub git_svn_log_cmd { - my ($r_min, $r_max, @args) = @_; - my $head = 'HEAD'; - my (@files, @log_opts); - foreach my $x (@args) { - if ($x eq '--' || @files) { - push @files, $x; - } else { - if (::verify_ref($x^0)) { - $head = $x; - } else { - push @log_opts, $x; - } - } - } - - my ($url, $rev, $uuid, $gs) = ::working_head_info($head); - $gs ||= Git::SVN-_new; - my @cmd = (qw/log --abbrev-commit --pretty=raw --default/, - $gs-refname); - push @cmd, '-r' unless $non_recursive; - push @cmd, qw/--raw --name-status/ if $verbose; - push @cmd, '--color' if log_use_color(); - push @cmd, @log_opts; - if (defined $r_max $r_max == $r_min) { - push @cmd, '--max-count=1'; - if (my $c = $gs-rev_map_get($r_max)) { - push @cmd, $c; - } - } elsif (defined $r_max) { - if ($r_max $r_min) { - ($r_min, $r_max) = ($r_max, $r_min); - } - my (undef, $c_max) = $gs-find_rev_before($r_max, 1, $r_min); - my (undef, $c_min) = $gs-find_rev_after($r_min, 1, $r_max); - # If there are no commits in the range, both $c_max and $c_min - # will be undefined. If there is at least 1 commit in the - # range, both will be defined. - return () if !defined $c_min || !defined $c_max; - if ($c_min eq $c_max) { - push @cmd, '--max-count=1', $c_min; - } else { - push @cmd, '--boundary', $c_min..$c_max; - } - } - return (@cmd, @files); -} - -# adapted from pager.c -sub config_pager { - if (! -t *STDOUT) { - $ENV{GIT_PAGER_IN_USE} = 'false'; - $pager = undef; - return; - } - chomp($pager = command_oneline(qw(var GIT_PAGER))); - if ($pager eq 'cat') { - $pager = undef; - } - $ENV{GIT_PAGER_IN_USE} = defined($pager); -} - -sub run_pager { - return unless defined $pager; - pipe my ($rfd, $wfd) or return; - defined(my $pid = fork) or fatal Can't fork: $!; - if (!$pid) { - open STDOUT, '', $wfd or -fatal Can't redirect to stdout: $!; - return; - } - open STDIN, '', $rfd or fatal Can't redirect stdin: $!; - $ENV{LESS} ||= 'FRSX'; - exec $pager or fatal Can't run pager: $! ($pager); -} - -sub format_svn_date { - my $t = shift || time; - my $gmoff = Git::SVN::get_tz($t); - return strftime(%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y), localtime($t)); -} - -sub parse_git_date { - my ($t, $tz) = @_; - # Date::Parse isn't in the
Extract Git classes from git-svn (4/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From 8f70be0424a770c299b6a0c5bf99e4030e5e4d92 Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Thu, 12 Jul 2012 16:58:53 -0700 Subject: [PATCH 05/11] Make Git::SVN::Log work. Changes to Git::SVN::Log to make it compile * Change the $_git_format lexical only used by Git::SVN::Log into a Git::SVN::Log global * Have it load the Git command functions itself --- git-svn.perl | 8 +--- perl/Git/SVN/Log.pm | 10 +- perl/Makefile | 1 + t/Git-SVN/00compile.t | 4 +++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/git-svn.perl b/git-svn.perl index 5e6e3b5..7c8ca49 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -11,6 +11,8 @@ $AUTHOR = 'Eric Wong normalper...@yhbt.net'; $VERSION = '@@GIT_VERSION@@'; use Git::SVN; +use Git::SVN::Log; + use Git::SVN::Utils qw(fatal can_compress); # From which subdir have we been invoked? @@ -88,7 +90,7 @@ BEGIN { foreach (qw/command command_oneline command_noisy command_output_pipe command_input_pipe command_close_pipe command_bidi_pipe command_close_bidi_pipe/) { - for my $package ( qw(Git::SVN::Migration Git::SVN::Log), + for my $package ( qw(Git::SVN::Migration), __PACKAGE__) { *{${package}::$_} = \{Git::$_}; } @@ -107,7 +109,7 @@ my ($_stdin, $_help, $_edit, $_version, $_fetch_all, $_no_rebase, $_fetch_parent, $_merge, $_strategy, $_preserve_merges, $_dry_run, $_local, $_prefix, $_no_checkout, $_url, $_verbose, - $_git_format, $_commit_url, $_tag, $_merge_info, $_interactive); + $_commit_url, $_tag, $_merge_info, $_interactive); # This is a refactoring artifact so Git::SVN can get at this variable. sub opt_prefix { return $_prefix || '' } @@ -271,7 +273,7 @@ my %cmd = ( { 'url' = \$_url, } ], 'blame' = [ \Git::SVN::Log::cmd_blame, Show what revision and author last modified each line of a file, - { 'git-format' = \$_git_format } ], + { 'git-format' = \$Git::SVN::Log::_git_format } ], 'reset' = [ \cmd_reset, Undo fetches back to the specified SVN revision, { 'revision|r=s' = \$_revision, diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm index bbec3b0..7f3cb87 100644 --- a/perl/Git/SVN/Log.pm +++ b/perl/Git/SVN/Log.pm @@ -1,12 +1,17 @@ package Git::SVN::Log; + use strict; use warnings; + +use Git qw(command command_oneline command_output_pipe command_close_pipe); use Git::SVN::Utils qw(fatal); use POSIX qw/strftime/; use constant commit_log_separator = ('-' x 72) . \n; use vars qw/$TZ $limit $color $pager $non_recursive $verbose $oneline %rusers $show_commit $incremental/; -my $l_fmt; + +# Options set in git-svn +our $_git_format; sub cmt_showable { my ($c) = @_; @@ -52,6 +57,7 @@ sub git_svn_log_cmd { } my ($url, $rev, $uuid, $gs) = ::working_head_info($head); + require Git::SVN; $gs ||= Git::SVN-_new; my @cmd = (qw/log --abbrev-commit --pretty=raw --default/, $gs-refname); @@ -113,6 +119,7 @@ sub run_pager { sub format_svn_date { my $t = shift || time; + require Git::SVN; my $gmoff = Git::SVN::get_tz($t); return strftime(%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y), localtime($t)); } @@ -183,6 +190,7 @@ sub process_commit { return 1; } +my $l_fmt; sub show_commit { my $c = shift; if ($oneline) { diff --git a/perl/Makefile b/perl/Makefile index d0a0c5c..2a4ca57 100644 --- a/perl/Makefile +++ b/perl/Makefile @@ -30,6 +30,7 @@ modules += Git/SVN modules += Git/SVN/Memoize/YAML modules += Git/SVN/Fetcher modules += Git/SVN/Editor +modules += Git/SVN/Log modules += Git/SVN/Prompt modules += Git/SVN/Ra modules += Git/SVN/Utils diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t index c32ee4b..37626f4 100644 --- a/t/Git-SVN/00compile.t +++ b/t/Git-SVN/00compile.t @@ -3,7 +3,9 @@ use strict; use warnings; -use Test::More tests = 2; +use Test::More tests = 4; require_ok 'Git::SVN'; require_ok 'Git::SVN::Utils'; +require_ok 'Git::SVN::Ra'; +require_ok 'Git::SVN::Log'; -- 1.7.11.1 -- 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
Extract Git classes from git-svn (5/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From ab67ab421dbfd248b9a198b8cc1cd9944ba6178d Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Tue, 17 Jul 2012 15:46:44 -0700 Subject: [PATCH 06/11] Move Git::SVN::Migration into its own file. Just a straight cut paste, the fixes come next commit. --- git-svn.perl | 246 - perl/Git/SVN/Migration.pm | 247 ++ 2 files changed, 247 insertions(+), 246 deletions(-) create mode 100644 perl/Git/SVN/Migration.pm diff --git a/git-svn.perl b/git-svn.perl index 7c8ca49..f2bf759 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2043,252 +2043,6 @@ sub gc_directory { } -package Git::SVN::Migration; -# these version numbers do NOT correspond to actual version numbers -# of git nor git-svn. They are just relative. -# -# v0 layout: .git/$id/info/url, refs/heads/$id-HEAD -# -# v1 layout: .git/$id/info/url, refs/remotes/$id -# -# v2 layout: .git/svn/$id/info/url, refs/remotes/$id -# -# v3 layout: .git/svn/$id, refs/remotes/$id -#- info/url may remain for backwards compatibility -#- this is what we migrate up to this layout automatically, -#- this will be used by git svn init on single branches -# v3.1 layout (auto migrated): -#- .rev_db = .rev_db.$UUID, .rev_db will remain as a symlink -# for backwards compatibility -# -# v4 layout: .git/svn/$repo_id/$id, refs/remotes/$repo_id/$id -#- this is only created for newly multi-init-ed -# repositories. Similar in spirit to the -# --use-separate-remotes option in git-clone (now default) -#- we do not automatically migrate to this (following -# the example set by core git) -# -# v5 layout: .rev_db.$UUID = .rev_map.$UUID -#- newer, more-efficient format that uses 24-bytes per record -# with no filler space. -#- use xxd -c24 .rev_map.$UUID to view and debug -#- This is a one-way migration, repositories updated to the -# new format will not be able to use old git-svn without -# rebuilding the .rev_db. Rebuilding the rev_db is not -# possible if noMetadata or useSvmProps are set; but should -# be no problem for users that use the (sensible) defaults. -use strict; -use warnings; -use Carp qw/croak/; -use File::Path qw/mkpath/; -use File::Basename qw/dirname basename/; -use vars qw/$_minimize/; - -sub migrate_from_v0 { - my $git_dir = $ENV{GIT_DIR}; - return undef unless -d $git_dir; - my ($fh, $ctx) = command_output_pipe(qw/rev-parse --symbolic --all/); - my $migrated = 0; - while ($fh) { - chomp; - my ($id, $orig_ref) = ($_, $_); - next unless $id =~ s#^refs/heads/(.+)-HEAD$#$1#; - next unless -f $git_dir/$id/info/url; - my $new_ref = refs/remotes/$id; - if (::verify_ref($new_ref^0)) { - print STDERR W: $orig_ref is probably an old , -branch used by an ancient version of , -git-svn.\n, -However, $new_ref also exists.\n, -We will not be able , -to use this branch until this , -ambiguity is resolved.\n; - next; - } - print STDERR Migrating from v0 layout...\n if !$migrated; - print STDERR Renaming ref: $orig_ref = $new_ref\n; - command_noisy('update-ref', $new_ref, $orig_ref); - command_noisy('update-ref', '-d', $orig_ref, $orig_ref); - $migrated++; - } - command_close_pipe($fh, $ctx); - print STDERR Done migrating from v0 layout...\n if $migrated; - $migrated; -} - -sub migrate_from_v1 { - my $git_dir = $ENV{GIT_DIR}; - my $migrated = 0; - return $migrated unless -d $git_dir; - my $svn_dir = $git_dir/svn; - - # just in case somebody used 'svn' as their $id at some point... - return $migrated if -d $svn_dir ! -f $svn_dir/info/url; - - print STDERR Migrating from a git-svn v1 layout...\n; - mkpath([$svn_dir]); - print STDERR Data from a previous version of git-svn exists, but\n\t, -$svn_dir\n\t(required for this version , -($::VERSION) of git-svn) does not exist.\n; - my ($fh, $ctx) = command_output_pipe(qw/rev-parse --symbolic --all/); - while ($fh) { - my $x = $_; - next unless $x =~ s#^refs/remotes/##; - chomp $x; - next unless -f $git_dir/$x/info/url; - my $u = eval { ::file_to_s($git_dir/$x/info/url) }; - next unless $u; - my $dn =
Extract Git classes from git-svn (6/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From cb1a73929da15e87fa3dcc41c4cfa9ca592081fa Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Thu, 12 Jul 2012 17:14:24 -0700 Subject: [PATCH 07/11] Fix Git::SVN::Migration after its move. Also... * eliminate the big import all the Git command functions loop, nothing needs it any more * only load Git::SVN::Migration if we need it --- git-svn.perl | 28 +++- perl/Git/SVN/Migration.pm | 16 +++- perl/Makefile | 1 + t/Git-SVN/00compile.t | 3 ++- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/git-svn.perl b/git-svn.perl index f2bf759..8b8607d 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -11,7 +11,6 @@ $AUTHOR = 'Eric Wong normalper...@yhbt.net'; $VERSION = '@@GIT_VERSION@@'; use Git::SVN; -use Git::SVN::Log; use Git::SVN::Utils qw(fatal can_compress); @@ -77,24 +76,26 @@ use File::Spec; use File::Find; use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/; use IPC::Open3; -use Git; + +use Git qw( +git_cmd_try +command +command_oneline +command_noisy +command_output_pipe +command_close_pipe +command_bidi_pipe +command_close_bidi_pipe +); + use Git::SVN::Editor qw//; use Git::SVN::Fetcher qw//; -use Git::SVN::Ra qw//; +use Git::SVN::Log; use Git::SVN::Prompt qw//; +use Git::SVN::Ra qw//; use Memoize; # core since 5.8.0, Jul 2002 BEGIN { - # import functions from Git into our packages, en masse - no strict 'refs'; - foreach (qw/command command_oneline command_noisy command_output_pipe - command_input_pipe command_close_pipe - command_bidi_pipe command_close_bidi_pipe/) { - for my $package ( qw(Git::SVN::Migration), - __PACKAGE__) { - *{${package}::$_} = \{Git::$_}; - } - } Memoize::memoize 'Git::config'; Memoize::memoize 'Git::config_bool'; } @@ -365,6 +366,7 @@ if (defined $_authors_prog) { } unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) { + require Git::SVN::Migration; Git::SVN::Migration::migration_check(); } Git::SVN::init_vars(); diff --git a/perl/Git/SVN/Migration.pm b/perl/Git/SVN/Migration.pm index 082a788..b17fe00 100644 --- a/perl/Git/SVN/Migration.pm +++ b/perl/Git/SVN/Migration.pm @@ -32,12 +32,22 @@ package Git::SVN::Migration; # rebuilding the .rev_db. Rebuilding the rev_db is not # possible if noMetadata or useSvmProps are set; but should # be no problem for users that use the (sensible) defaults. + use strict; use warnings; + use Carp qw/croak/; use File::Path qw/mkpath/; use File::Basename qw/dirname basename/; -use vars qw/$_minimize/; + +our $_minimize; + +use Git qw( + command + command_noisy + command_output_pipe + command_close_pipe +); sub migrate_from_v0 { my $git_dir = $ENV{GIT_DIR}; @@ -146,6 +156,7 @@ sub migrate_from_v2 { read_old_urls(\%l_map, '', $ENV{GIT_DIR}/svn); my $migrated = 0; + require Git::SVN; foreach my $ref_id (sort keys %l_map) { eval { Git::SVN-init($l_map{$ref_id}, '', undef, $ref_id) }; if ($@) { @@ -157,6 +168,9 @@ sub migrate_from_v2 { } sub minimize_connections { + require Git::SVN; + require Git::SVN::Ra; + my $r = Git::SVN::read_all_remotes(); my $new_urls = {}; my $root_repos = {}; diff --git a/perl/Makefile b/perl/Makefile index 2a4ca57..d6a0e84 100644 --- a/perl/Makefile +++ b/perl/Makefile @@ -31,6 +31,7 @@ modules += Git/SVN/Memoize/YAML modules += Git/SVN/Fetcher modules += Git/SVN/Editor modules += Git/SVN/Log +modules += Git/SVN/Migration modules += Git/SVN/Prompt modules += Git/SVN/Ra modules += Git/SVN/Utils diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t index 37626f4..1307b65 100644 --- a/t/Git-SVN/00compile.t +++ b/t/Git-SVN/00compile.t @@ -3,9 +3,10 @@ use strict; use warnings; -use Test::More tests = 4; +use Test::More tests = 5; require_ok 'Git::SVN'; require_ok 'Git::SVN::Utils'; require_ok 'Git::SVN::Ra'; require_ok 'Git::SVN::Log'; +require_ok 'Git::SVN::Migration'; -- 1.7.11.1 -- 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
Extract Git classes from git-svn (7/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From 9ff49d9e91c9741d501620ac47f78d8ff8ef9983 Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Tue, 17 Jul 2012 15:51:53 -0700 Subject: [PATCH 08/11] Cut paste Git::IndexInfo into its own file. No other changes, those are next commit so they can be seen in the diff. --- git-svn.perl | 32 perl/Git/IndexInfo.pm | 33 + 2 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 perl/Git/IndexInfo.pm diff --git a/git-svn.perl b/git-svn.perl index 8b8607d..6632cfb 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2045,38 +2045,6 @@ sub gc_directory { } -package Git::IndexInfo; -use strict; -use warnings; -use Git qw/command_input_pipe command_close_pipe/; - -sub new { - my ($class) = @_; - my ($gui, $ctx) = command_input_pipe(qw/update-index -z --index-info/); - bless { gui = $gui, ctx = $ctx, nr = 0}, $class; -} - -sub remove { - my ($self, $path) = @_; - if (print { $self-{gui} } '0 ', 0 x 40, \t, $path, \0) { - return ++$self-{nr}; - } - undef; -} - -sub update { - my ($self, $mode, $hash, $path) = @_; - if (print { $self-{gui} } $mode, ' ', $hash, \t, $path, \0) { - return ++$self-{nr}; - } - undef; -} - -sub DESTROY { - my ($self) = @_; - command_close_pipe($self-{gui}, $self-{ctx}); -} - package Git::SVN::GlobSpec; use strict; use warnings; diff --git a/perl/Git/IndexInfo.pm b/perl/Git/IndexInfo.pm new file mode 100644 index 000..a43108c --- /dev/null +++ b/perl/Git/IndexInfo.pm @@ -0,0 +1,33 @@ +package Git::IndexInfo; +use strict; +use warnings; +use Git qw/command_input_pipe command_close_pipe/; + +sub new { + my ($class) = @_; + my ($gui, $ctx) = command_input_pipe(qw/update-index -z --index-info/); + bless { gui = $gui, ctx = $ctx, nr = 0}, $class; +} + +sub remove { + my ($self, $path) = @_; + if (print { $self-{gui} } '0 ', 0 x 40, \t, $path, \0) { + return ++$self-{nr}; + } + undef; +} + +sub update { + my ($self, $mode, $hash, $path) = @_; + if (print { $self-{gui} } $mode, ' ', $hash, \t, $path, \0) { + return ++$self-{nr}; + } + undef; +} + +sub DESTROY { + my ($self) = @_; + command_close_pipe($self-{gui}, $self-{ctx}); +} + +1; -- 1.7.11.1 -- 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
Extract Git classes from git-svn (8/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From 4fd7b8574b32753dcf22ec0a592f13586b938689 Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Thu, 12 Jul 2012 17:20:02 -0700 Subject: [PATCH 09/11] Fix Git::IndexInfo so it compiles. Only used by Git::SVN::Fetcher. --- perl/Git/IndexInfo.pm | 2 ++ perl/Git/SVN/Fetcher.pm | 2 ++ perl/Makefile | 1 + t/Git-SVN/00compile.t | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/perl/Git/IndexInfo.pm b/perl/Git/IndexInfo.pm index a43108c..9e454be 100644 --- a/perl/Git/IndexInfo.pm +++ b/perl/Git/IndexInfo.pm @@ -1,6 +1,8 @@ package Git::IndexInfo; + use strict; use warnings; + use Git qw/command_input_pipe command_close_pipe/; sub new { diff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm index ef8e9ed..69486ef 100644 --- a/perl/Git/SVN/Fetcher.pm +++ b/perl/Git/SVN/Fetcher.pm @@ -10,6 +10,8 @@ use IO::File qw//; use Git qw/command command_oneline command_noisy command_output_pipe command_input_pipe command_close_pipe command_bidi_pipe command_close_bidi_pipe/; +use Git::IndexInfo; + BEGIN { @ISA = qw(SVN::Delta::Editor); } diff --git a/perl/Makefile b/perl/Makefile index d6a0e84..6c32918 100644 --- a/perl/Makefile +++ b/perl/Makefile @@ -26,6 +26,7 @@ instdir_SQ = $(subst ','\'',$(prefix)/lib) modules += Git modules += Git/I18N +modules += Git/IndexInfo modules += Git/SVN modules += Git/SVN/Memoize/YAML modules += Git/SVN/Fetcher diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t index 1307b65..5419438 100644 --- a/t/Git-SVN/00compile.t +++ b/t/Git-SVN/00compile.t @@ -3,10 +3,11 @@ use strict; use warnings; -use Test::More tests = 5; +use Test::More tests = 6; require_ok 'Git::SVN'; require_ok 'Git::SVN::Utils'; require_ok 'Git::SVN::Ra'; require_ok 'Git::SVN::Log'; require_ok 'Git::SVN::Migration'; +require_ok 'Git::IndexInfo'; -- 1.7.11.1 -- 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
Extract Git classes from git-svn (9/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From 368d6c7883080d85f82b1eae1815834e3d59ef5e Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Tue, 17 Jul 2012 15:54:33 -0700 Subject: [PATCH 10/11] Cut paste Git::SVN::GlobSpec into its own file. Fixes to make it work come next commit. --- git-svn.perl | 58 --- perl/Git/SVN/GlobSpec.pm | 59 2 files changed, 59 insertions(+), 58 deletions(-) create mode 100644 perl/Git/SVN/GlobSpec.pm diff --git a/git-svn.perl b/git-svn.perl index 6632cfb..7b54f43 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2045,64 +2045,6 @@ sub gc_directory { } -package Git::SVN::GlobSpec; -use strict; -use warnings; - -sub new { - my ($class, $glob, $pattern_ok) = @_; - my $re = $glob; - $re =~ s!/+$!!g; # no need for trailing slashes - my (@left, @right, @patterns); - my $state = left; - my $die_msg = Only one set of wildcard directories . - (e.g. '*' or '*/*/*') is supported: '$glob'\n; - for my $part (split(m|/|, $glob)) { - if ($part =~ /\*/ $part ne *) { - die Invalid pattern in '$glob': $part\n; - } elsif ($pattern_ok $part =~ /[{}]/ -$part !~ /^\{[^{}]+\}/) { - die Invalid pattern in '$glob': $part\n; - } - if ($part eq *) { - die $die_msg if $state eq right; - $state = pattern; - push(@patterns, [^/]*); - } elsif ($pattern_ok $part =~ /^\{(.*)\}$/) { - die $die_msg if $state eq right; - $state = pattern; - my $p = quotemeta($1); - $p =~ s/\\,/|/g; - push(@patterns, (?:$p)); - } else { - if ($state eq left) { - push(@left, $part); - } else { - push(@right, $part); - $state = right; - } - } - } - my $depth = @patterns; - if ($depth == 0) { - die One '*' is needed in glob: '$glob'\n; - } - my $left = join('/', @left); - my $right = join('/', @right); - $re = join('/', @patterns); - $re = join('\/', - grep(length, quotemeta($left), ($re), quotemeta($right))); - my $left_re = qr/^\/\Q$left\E(\/|$)/; - bless { left = $left, right = $right, left_regex = $left_re, - regex = qr/$re/, glob = $glob, depth = $depth }, $class; -} - -sub full_path { - my ($self, $path) = @_; - return (length $self-{left} ? $self-{left}/ : '') . - $path . (length $self-{right} ? /$self-{right} : ''); -} - __END__ Data structures: diff --git a/perl/Git/SVN/GlobSpec.pm b/perl/Git/SVN/GlobSpec.pm new file mode 100644 index 000..96cfd98 --- /dev/null +++ b/perl/Git/SVN/GlobSpec.pm @@ -0,0 +1,59 @@ +package Git::SVN::GlobSpec; +use strict; +use warnings; + +sub new { + my ($class, $glob, $pattern_ok) = @_; + my $re = $glob; + $re =~ s!/+$!!g; # no need for trailing slashes + my (@left, @right, @patterns); + my $state = left; + my $die_msg = Only one set of wildcard directories . + (e.g. '*' or '*/*/*') is supported: '$glob'\n; + for my $part (split(m|/|, $glob)) { + if ($part =~ /\*/ $part ne *) { + die Invalid pattern in '$glob': $part\n; + } elsif ($pattern_ok $part =~ /[{}]/ +$part !~ /^\{[^{}]+\}/) { + die Invalid pattern in '$glob': $part\n; + } + if ($part eq *) { + die $die_msg if $state eq right; + $state = pattern; + push(@patterns, [^/]*); + } elsif ($pattern_ok $part =~ /^\{(.*)\}$/) { + die $die_msg if $state eq right; + $state = pattern; + my $p = quotemeta($1); + $p =~ s/\\,/|/g; + push(@patterns, (?:$p)); + } else { + if ($state eq left) { + push(@left, $part); + } else { + push(@right, $part); + $state = right; + } + } + } + my $depth = @patterns; + if ($depth == 0) { + die One '*' is needed in glob: '$glob'\n; + } + my $left = join('/', @left); + my $right = join('/', @right); + $re = join('/', @patterns); + $re = join('\/', + grep(length, quotemeta($left), ($re),
Extract Git classes from git-svn (10/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
From 5152b76800f076ba0bd528664f62d3c67966fa4e Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Thu, 12 Jul 2012 17:25:25 -0700 Subject: [PATCH 11/11] Fix Git::SVN::GlobSpec so it works. Only used in one place in Git::SVN, load it on demand. That should be all the Git classes out of git-svn. --- perl/Git/SVN.pm | 5 - perl/Git/SVN/GlobSpec.pm | 1 + perl/Makefile| 1 + t/Git-SVN/00compile.t| 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm index 02983d6..247ee1d 100644 --- a/perl/Git/SVN.pm +++ b/perl/Git/SVN.pm @@ -202,11 +202,14 @@ sub read_all_remotes { . must start with 'refs/'\n) unless $remote_ref =~ m{^refs/}; $local_ref = uri_decode($local_ref); + + require Git::SVN::GlobSpec; my $rs = { t = $t, remote = $remote, path = Git::SVN::GlobSpec-new($local_ref, 1), - ref = Git::SVN::GlobSpec-new($remote_ref, 0) }; + ref = Git::SVN::GlobSpec-new($remote_ref, 0) + }; if (length($rs-{ref}-{right}) != 0) { die The '*' glob character must be the last , character of '$remote_ref'\n; diff --git a/perl/Git/SVN/GlobSpec.pm b/perl/Git/SVN/GlobSpec.pm index 96cfd98..fede3af 100644 --- a/perl/Git/SVN/GlobSpec.pm +++ b/perl/Git/SVN/GlobSpec.pm @@ -1,4 +1,5 @@ package Git::SVN::GlobSpec; + use strict; use warnings; diff --git a/perl/Makefile b/perl/Makefile index 6c32918..aa4a28b 100644 --- a/perl/Makefile +++ b/perl/Makefile @@ -31,6 +31,7 @@ modules += Git/SVN modules += Git/SVN/Memoize/YAML modules += Git/SVN/Fetcher modules += Git/SVN/Editor +modules += Git/SVN/GlobSpec modules += Git/SVN/Log modules += Git/SVN/Migration modules += Git/SVN/Prompt diff --git a/t/Git-SVN/00compile.t b/t/Git-SVN/00compile.t index 5419438..c92fee4 100644 --- a/t/Git-SVN/00compile.t +++ b/t/Git-SVN/00compile.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests = 6; +use Test::More tests = 7; require_ok 'Git::SVN'; require_ok 'Git::SVN::Utils'; @@ -11,3 +11,4 @@ require_ok 'Git::SVN::Ra'; require_ok 'Git::SVN::Log'; require_ok 'Git::SVN::Migration'; require_ok 'Git::IndexInfo'; +require_ok 'Git::SVN::GlobSpec'; -- 1.7.11.1 -- 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: Extract Git classes from git-svn (1/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
Hi, Michael G Schwern wrote: There's five classes, so this is ten patches. Let me go on record again to state that this one-inline-patch-per-email is a lot of busy work for me. Well, there's no need to protest and go along with it if it's a bad idea. It's just what we've found to be the easiest way in the past to review and have a discussion about each patch, but if you know a better way, I'm happy to hear for next time. The mailing list archive at http://news.gmane.org/gmane.comp.version-control.git might be useful for seeing some examples of how it plays out in practice. You mind find the git send-email tool to be helpful for automating some of the tedious steps of sending a patch series out. It also does some other nice things, like setting the subject lines in a more useful way. :) Thanks, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Find .pm files automatically (was Re: Fix git-svn tests for SVN 1.7.5.)
Hi, Michael G Schwern wrote: Ok, here goes. First patch overhauls perl/Makefile.PL to make it easier to add .pm files, which I'm going to be doing a lot of. Instead of having to manually add to the %pm hash, it scans for .pm files. An excellent goal. It also moves Error.pm into a bundle directory. This both makes it just another directory to scan (or not scan), but it also makes it possible to bundle additional modules in the future. ExtUtils::MakeMaker uses this technique itself. This is not so much also as as an example to demonstrate the technique, no? I guess I'd prefer it to be in a separate patch, but this way's fine, too. [...] From 47a723a860cded6b16a716ea74c5bc029ee5b0ac Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Thu, 12 Jul 2012 00:05:38 -0700 Subject: [PATCH 01/11] Make the process of adding a module less blecherous. * Scan for .pm files and build %pms rather than having to do it by hand. * Move the bundled Error into its own directory so we can bundle other modules. In addition... * Add all the .pm files to the all dependency in the alternative Makefile --- You'll probably hate this. Because we have a bunch of patches to incorporate, I think it's worth spending the time to make that go as smoothly as possible for later patches. - the From 47a723... line is for your mailer. Please do not include it in the body of your message. - likewise for the From: and Date: lines which are redundant next to the corresponding fields in the mail header - comments that are useful for posterity, like This patch overhauls perl/Makefile.PL to make it easier to add .pm files, which I'm going to be doing a lot of. Instead of having to manually add to the %pm hash, it scans for .pm files. should go above the triple-dash marker, while comments that are less useful, like Hi, go after the triple-dash. - using a different subject line for each patch makes the reader's life much easier, so please do use the subject lines from your commits in the mail header. The git-format-patch(1) manpage has some instructions for using Thunderbird to send patches, which should take care of all this automatically. If everything is right, then maintainers will love you because they can save a bunch of your patches that look ready into a single mbox and apply them all at once with git am. As Documentation/SubmittingPatches explains under MUA specific hints, you can test that a patch is being sent correctly by emailing it to yourself, saving as an mbox, and trying to apply it with git am path to mbox file. If the resulting commit is as expected, then you've succeeded. perl/Makefile | 6 ++-- perl/Makefile.PL | 42 +-- perl/{private-Error.pm = bundles/Error/Error.pm} | 0 perl/bundles/README | 10 ++ 4 files changed, 36 insertions(+), 22 deletions(-) rename perl/{private-Error.pm = bundles/Error/Error.pm} (100%) create mode 100644 perl/bundles/README Ok, on to the patch proper. diff --git a/perl/Makefile b/perl/Makefile index 6ca7d47..4f25930 100644 --- a/perl/Makefile +++ b/perl/Makefile @@ -33,7 +33,7 @@ modules += Git/SVN/Prompt modules += Git/SVN/Ra $(makfile): ../GIT-CFLAGS Makefile - echo all: private-Error.pm Git.pm Git/I18N.pm $@ + echo all: bundles/Error/Error.pm $(modules) $@ The word bundles/ left me a little nervous, because I (ignorantly) imagined that this might be some specialized facility like Python eggs or Ruby gems. Is the intent that this directory contains CPAN modules we want to be able to depend on? Is there really any intention of having more of them than Error.pm? Before this patch, in the default case (with MakeMaker), make install wrote a manpage in mandir/man3/private-Error.3pm. Does it still do so after the patch? Will people who have installation scripts that expected that manpage have to change them, and if so, is the new behavior better to make up for that effort? [...] --- a/perl/Makefile.PL +++ b/perl/Makefile.PL @@ -2,11 +2,16 @@ use strict; use warnings; use ExtUtils::MakeMaker; use Getopt::Long; +use File::Find; + +# Don't forget to update the perl/Makefile, too. +# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease Now the reader will have no reason to be looking at this file, so these comments are pretty much useless. In an ideal world, make test in the MakeMaker build would automatically grep perl/Makefile to catch modules that are not listed there, but that can wait, I imagine. Alternatively, maybe there could be a perl/modules.list that both makefiles read? That way, if I drop in an unrelated .pm file for reference while coding the build system would not be confused by it, and since both build systems would use the same module list there would be no risk of it falling out of date. Thanks
Re: Extract Git classes from git-svn (2/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
Hi, Michael G Schwern wrote: From 683a230e439f1d5ac2727ce4c2a74e93804fc72b Mon Sep 17 00:00:00 2001 From: Michael G. Schwern schw...@pobox.com Date: Wed, 11 Jul 2012 22:16:01 -0700 Just like with patch 1, the mail body should lose the above. Subject: [PATCH 03/11] Fix Git::SVN so it can at least compile alone. Did I miss patch 2? It's still very intertwined with git-svn, but that's a lot of work. This gets things working and tests passing again (as well as they were). This required some parallel refactorings... * fatal() moved out of git-svn into a new Git::SVN::Utils [...] git-svn.perl | 33 ++--- perl/Git/SVN.pm| 29 - perl/Git/SVN/Utils.pm | 19 +++ perl/Makefile | 2 ++ t/Git-SVN/00compile.t | 9 + t/Git-SVN/Utils/can_compress.t | 11 +++ t/Git-SVN/Utils/fatal.t| 34 ++ 7 files changed, 113 insertions(+), 24 deletions(-) create mode 100644 perl/Git/SVN/Utils.pm create mode 100644 t/Git-SVN/00compile.t create mode 100644 t/Git-SVN/Utils/can_compress.t create mode 100644 t/Git-SVN/Utils/fatal.t It seems like a lot is going on in the one patch. Probably most of the changes are good, but if this causes a regression we would have no choice but to revert the whole thing, which would be unfeasible because of later patches building on it. So in other words, a patch like this that makes a lot of changes at once would make life very hard for the maintainer, I imagine. What is the motivation behind these changes? Can they be untangled from each other and applied one at a time, in such a way that each incremental change looks obviously correct? Since I'm missing the patch that created Git/SVN.pm in the first place, I can't tell --- did that patch break the build and this one fixes it? In that case, the order of the two patches should be swapped to ensure git bisect is still usable. Sorry, I wish I had better news to mix in with all this. I am thrilled to see this is making the internal APIs saner and adding tests so I hope we can get it in in a way that makes regressions unlikely. Thanks, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Extract Git classes from git-svn (3/10) (was Re: Fix git-svn tests for SVN 1.7.5.)
Michael G Schwern wrote: This is a straight cut paste. Next commit will make it work. As mentioned in reply to patch 3, we can't take this, but by swapping the order of the two patches it should be possible to make it work. Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: git-p4: Jobs and skipSubmitEdit
m...@horowitz.name wrote on Tue, 17 Jul 2012 04:49 -0400: I gave the patch a try, and it seems to work great. Only problem I realized is that it means that the git commit message and the p4 log message end up different, because to p4 the jobs lines are special and get stripped out, but in git it just stays part of the commit message. So, when you do a p4 sync/rebase, the commits come back without it. This doesn't make much of difference now, because the commit messages come back modified with the p4 path and changelist number anyway, but if Luke tries to do that change to store the p4 path/changelist in notes instead, then we wouldn't want any differences in the commit messages, because then the commits hashes won't match again. Not sure what the best thing to do here is, but I guess it doesn't matter until this mythical notes thing happens. Glad it works. I didn't think about trying to make the commit messages exact. That isn't required for, e.g. git cherry, but might be nice just to make git/p4 view of the changes more similar. Okay if we wait and see how the notes stuff goes, like you suggest. Could be that Jobs ends up in a note too. Thanks for testing. -- Pete -- 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] diff: respect --no-ext-diff with typechange
Yes, I was fixing the invalid (!pgm) condition, sorry for a non-precise description. Does it mean that my patch is accepted or is there something else I need to do? -- Jakub Vrana -Original Message- From: Jeff King [mailto:p...@peff.net] Sent: Monday, July 16, 2012 9:16 PM To: Jakub Vrana Cc: git@vger.kernel.org; gits...@pobox.com Subject: Re: [PATCH] diff: respect --no-ext-diff with typechange On Mon, Jul 16, 2012 at 05:27:00PM -0700, Jakub Vrana wrote: If external diff is specified through diff.external then it is used even if `git diff --no-ext-diff` is used when there is a typechange. Eek. That has some minor security implications, as it means that it is dangerous to run even plumbing inspection command in somebody else's repository. However... diff.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/diff.c b/diff.c index 208096f..898d610 100644 --- a/diff.c +++ b/diff.c @@ -3074,6 +3074,9 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o) if (o-prefix_length) strip_prefix(o-prefix_length, name, other); + if (!DIFF_OPT_TST(o, ALLOW_EXTERNAL)) + pgm = NULL; + if (DIFF_PAIR_UNMERGED(p)) { run_diff_cmd(pgm, name, NULL, attr_path, NULL, NULL, NULL, o, p); run_diff_cmd already checks the ALLOW_EXTERNAL bit and sets pgm to NULL there. So as far as I can tell, we are not actually running the external diff. However, there is still a problem. Later in run_diff we do: if (!pgm DIFF_FILE_VALID(one) DIFF_FILE_VALID(two) (S_IFMT one-mode) != (S_IFMT two-mode)) { /* * a filepair that changes between file and symlink * needs to be split into deletion and creation. */ struct diff_filespec *null = alloc_filespec(two-path); run_diff_cmd(NULL, name, other, attr_path, one, null, msg, o, p); free(null); strbuf_release(msg); null = alloc_filespec(one-path); run_diff_cmd(NULL, name, other, attr_path, null, two, msg, o, p); free(null); } else run_diff_cmd(pgm, name, other, attr_path, one, two, msg, o, p); IOW, we split up a typechange if we are feeding it to the internal diff generator, because builtin_diff will not show diffs between different types. But the check for !pgm here is not right; we don't know yet whether we will be builtin or external, because we have not checked ALLOW_EXTERNAL yet. So I think your fix is the right thing, but the bug it is fixing is not do not run external diff even when --no-ext-diff is specified. It is do not accidentally feed typechange diffs to builtin_diff. You can see the difference in output with this script (and it works fine with your patch applied): git init -q repo cd repo echo content file git add file git commit -q -m regular rm file ln -s dest file git commit -q -a -m typechange export GIT_PAGER=cat export GIT_EXTERNAL_DIFF='echo doing external diff' git show HEAD^ --format='=== %s, ext ===' --ext-diff git show HEAD^ --format='=== %s, no-ext ===' --no-ext-diff git show HEAD --format='=== %s, ext ===' --ext-diff git show HEAD --format='=== %s, no-ext ===' --no-ext-diff -Peff -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Find .pm files automatically (was Re: Fix git-svn tests for SVN 1.7.5.)
On 2012.7.17 5:01 PM, Jonathan Nieder wrote: It also moves Error.pm into a bundle directory. This both makes it just another directory to scan (or not scan), but it also makes it possible to bundle additional modules in the future. ExtUtils::MakeMaker uses this technique itself. This is not so much also as as an example to demonstrate the technique, no? I guess I'd prefer it to be in a separate patch, but this way's fine, too. I wrote the MakeMaker system so I was just cribbing off that. It made more sense to build a list of directories to scan and then scan them than to add individual file exceptions later. I could put it in a separate patch, but it would require some bending. You'll probably hate this. Because we have a bunch of patches to incorporate, I think it's worth spending the time to make that go as smoothly as possible for later patches. Sorry. I have lots of experience with git but very little with the email submission tools. I've always either just done everything via repositories or used Github. It sounds like I should figure out the git-send-email tool and do this very slowly. The word bundles/ left me a little nervous, because I (ignorantly) imagined that this might be some specialized facility like Python eggs or Ruby gems. Nope, just copy .pm files in. Is the intent that this directory contains CPAN modules we want to be able to depend on? Yes. Is there really any intention of having more of them than Error.pm? No idea, this is my first look at the code, but now it's possible. In my experience, if there's a barrier to using CPAN modules then people won't use them. They'll rewrite the functionality poorly. Before this patch, in the default case (with MakeMaker), make install wrote a manpage in mandir/man3/private-Error.3pm. Does it still do so after the patch? Will people who have installation scripts that expected that manpage have to change them, and if so, is the new behavior better to make up for that effort? The man page is now man3/bundles::Error::Error.3 which is equally as incorrect as man3/private-Error.3. It is possible to correct that so it's man3/Error.3, but that's going to require some effort. Basically its in the same boat as PM. Once you have to change one you have to change them all. Why do install scripts have specific code to look for that man page? If it's going to be trouble I can put Error.pm back. It's just something I did in passing. +# Don't forget to update the perl/Makefile, too. +# Don't forget to test with NO_PERL_MAKEMAKER=YesPlease Now the reader will have no reason to be looking at this file, so these comments are pretty much useless. In an ideal world, make test in the MakeMaker build would automatically grep perl/Makefile to catch modules that are not listed there, but that can wait, I imagine. Alternatively, maybe there could be a perl/modules.list that both makefiles read? That way, if I drop in an unrelated .pm file for reference while coding the build system would not be confused by it, and since both build systems would use the same module list there would be no risk of it falling out of date. Ideally, that second Makefile would go away. Parallel build systems are extra work and generate bugs. The log suggests it might have something to do with people wanting to build with an ActiveState Perl on Cygwin or something? MakeMaker builds different Makefiles depending on the OS, so it may be as simple as telling Makefile.PL what flavor of make you're using. -- emacs -- THAT'S NO EDITOR... IT'S AN OPERATING SYSTEM! -- 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: Find .pm files automatically (was Re: Fix git-svn tests for SVN 1.7.5.)
Thanks for the reply. Quick clarifications: Michael G Schwern wrote: The man page is now man3/bundles::Error::Error.3 which is equally as incorrect as man3/private-Error.3. It is possible to correct that so it's man3/Error.3, but that's going to require some effort. Basically its in the same boat as PM. Once you have to change one you have to change them all. Why do install scripts have specific code to look for that man page? To delete it. :) [...] Ideally, that second Makefile would go away. Parallel build systems are extra work and generate bugs. Agreed --- I'd love to see the NO_PERL_MAKEMAKER option go away. The log suggests it might have something to do with people wanting to build with an ActiveState Perl on Cygwin or something? MakeMaker builds different Makefiles depending on the OS, so it may be as simple as telling Makefile.PL what flavor of make you're using. I think the main user is the ordinary Git for Windows build (which uses perl 5.8.8, from mingw or msys I imagine). If you have the Windows expertise to help them or know someone who could, I'm sure they'd be happy to switch their git build to use MakeMaker. Website: http://msysgit.github.com/ Thanks, Jonathan -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] diff: respect --no-ext-diff with typechange
Jakub Vrana ja...@vrana.cz writes: Yes, I was fixing the invalid (!pgm) condition, sorry for a non-precise description. Does it mean that my patch is accepted or is there something else I need to do? The impression I got from Peff's review was that the problem description in the proposed commit log message did not describe the reality at all, and the added three lines did not do what the message implied they do. So I do not see how it can be acceptable by anybody. It also needs a test to protect this fix from being broken by other people in the future. I've followed the codepath myself, and here is what I would have liked the submitted patch to look like. Note that run_diff_cmd() no longer needs to reset pgm to NULL based on ALLOW_EXTERNAL, but it still needs to look at it to decide if per-path external userdiff needs to be called. -- 8 -- Subject: diff: correctly disable external_diff with --no-ext-diff Upon seeing a type-change filepair, diff --no-ext-diff does not show the usual deletion followed by addition split patch and does not run the external diff driver either. This is because the logic to disable external diff was placed at a wrong level in the callchain. run_diff_cmd() decides to show the split patch only when external diff driver is not configured or specified via GIT_EXTERNAL_DIFF environment, but this is done before checking if --no-ext-diff was given. To make things worse, run_diff_cmd() checks --no-ext-diff and disables the output for such a filepair completely, as the callchain below it (e.g. builtin_diff) does not want to handle typechange filepairs. Signed-off-by: Junio C Hamano gits...@pobox.com --- * The use of userdiff_find_by_path() in run_diff_cmd() may be iffy; it is probably OK to override diff.external with a more specific per-path configuration, but I think an external diff specified by the GIT_EXTERNAL_DIFF environment may want to trump the configured per-path one, as an environment is a stronger one-shot request. But this patch is not about changing that semantics, so I left it as-is. diff.c | 8 +--- t/t4020-diff-external.sh | 19 +++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 208096f..62cbe14 100644 --- a/diff.c +++ b/diff.c @@ -2992,9 +2992,8 @@ static void run_diff_cmd(const char *pgm, int complete_rewrite = (p-status == DIFF_STATUS_MODIFIED) p-score; int must_show_header = 0; - if (!DIFF_OPT_TST(o, ALLOW_EXTERNAL)) - pgm = NULL; - else { + + if (DIFF_OPT_TST(o, ALLOW_EXTERNAL)) { struct userdiff_driver *drv = userdiff_find_by_path(attr_path); if (drv drv-external) pgm = drv-external; @@ -3074,6 +3073,9 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o) if (o-prefix_length) strip_prefix(o-prefix_length, name, other); + if (!DIFF_OPT_TST(o, ALLOW_EXTERNAL)) + pgm = NULL; + if (DIFF_PAIR_UNMERGED(p)) { run_diff_cmd(pgm, name, NULL, attr_path, NULL, NULL, NULL, o, p); diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index 533afc1..5a5f68c 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -48,7 +48,26 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment and --no-ext-diff' ' ' +test_expect_success SYMLINKS 'typechange diff' ' + rm -f file + ln -s elif file + GIT_EXTERNAL_DIFF=echo git diff | { + read path oldfile oldhex oldmode newfile newhex newmode + test z$path = zfile + test z$oldmode = z100644 + test z$newhex = z$_z40 + test z$newmode = z12 + oh=$(git rev-parse --verify HEAD:file) + test z$oh = z$oldhex + } + GIT_EXTERNAL_DIFF=echo git diff --no-ext-diff actual + git diff expect + test_cmp expect actual +' + test_expect_success 'diff attribute' ' + git reset --hard + echo third file git config diff.parrot.command echo -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix Q-encoded multi-octet-char split in email.
Ping on a seemingly stalled thread. -- 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: Extract Git classes from git-svn (1/10)
Jonathan Nieder jrnie...@gmail.com writes: The mailing list archive at http://news.gmane.org/gmane.comp.version-control.git might be useful for seeing some examples of how it plays out in practice. By allowing people to easily publish a completed work, and making it easier for them to let others peek at their work, Git hosting services like GitHub are wonderful. But I am not conviced that quality code reviews like we do on the mailing list can be done with existing Web based interface to a satisfactory degree. Patches with proposed commit log messages are sent via e-mail, people can review them and comment on them with quotes from the relevant part of the patch. The review can even be made offline, yet at the end, the list archive is an easy one-stop location you need to go to see how the changes progressed, what the background thinking was, etc. for all the changes that matter. Look at recent ones (randomly, $gmane/199492, $gmane/199497, $gmane/200750, $gmane/201477, $gmane/201434), and their re-rolls, and admire how well the process works. I've played with GitHub's in-line code comment interface, but honestly, it is cumbersome to use, for one thing, but more importantly, you have to click around various repositories of pull requestors, dig around to see in-line comments, and I do not see how we can keep a coherent discussion like we do on the mailing list. There may be a hosting site with better code review features, but all the code review of Git happens on this mailing list, and that is not likely to change in the near future. [Footnote] $gmane stands for http://thread.gmane.org/gmane.comp.version-control.git/ in the above description. -- 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_getpass regression?
Ping on seemingly stalled discussion. -- 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