* What's cooking in git.git (Jan 2010, #06 draft)
From: Junio C Hamano @ 2010-01-20 10:24 UTC (permalink / raw)
To: git
This is a draft copy of the real one I would send out after my git
Wednesday is over.
But before that day begins, I need to go to sleep ;-)
---
Here are the topics that have been cooking. Commits prefixed with '-' are
only in 'pu' while commits prefixed with '+' are in 'next'. The ones
marked with '.' do not appear in any of the integration branches, but I am
still holding onto them.
--------------------------------------------------
[Graduated to "master"]
* sr/gfi-options (2009-12-04) 7 commits
(merged to 'next' on 2010-01-10 at 8b305fb)
+ fast-import: add (non-)relative-marks feature
+ fast-import: allow for multiple --import-marks= arguments
+ fast-import: test the new option command
+ fast-import: add option command
+ fast-import: add feature command
+ fast-import: put marks reading in its own function
+ fast-import: put option parsing code in separate functions
* tc/smart-http-restrict (2010-01-14) 5 commits
(merged to 'next' on 2010-01-16 at 71fc84c)
+ Test t5560: Fix test when run with dash
(merged to 'next' on 2010-01-06 at 82736cb)
+ Smart-http tests: Test http-backend without curl or a webserver
+ Smart-http tests: Break test t5560-http-backend into pieces
+ Smart-http tests: Improve coverage in test t5560
+ Smart-http: check if repository is OK to export before serving it
* tc/clone-v-progress (2009-12-26) 4 commits
(merged to 'next' on 2010-01-10 at ec2bfd7)
+ clone: use --progress to force progress reporting
+ clone: set transport->verbose when -v/--verbose is used
+ git-clone.txt: reword description of progress behaviour
+ check stderr with isatty() instead of stdout when deciding to show progress
Perhaps needs an entry in the Release Notes, but otherwise looked Ok.
* jk/run-command-use-shell (2010-01-01) 8 commits
(merged to 'next' on 2010-01-10 at 7479e2a)
+ t4030, t4031: work around bogus MSYS bash path conversion
+ diff: run external diff helper with shell
+ textconv: use shell to run helper
+ editor: use run_command's shell feature
+ run-command: optimize out useless shell calls
+ run-command: convert simple callsites to use_shell
+ t0021: use $SHELL_PATH for the filter script
+ run-command: add "use shell" option
Shuffled the commits in the topic, following J6t's suggestion in
http://thread.gmane.org/gmane.comp.version-control.git/136128
* jn/makefile (2010-01-06) 4 commits
(merged to 'next' on 2010-01-10 at f5a5d42)
+ Makefile: consolidate .FORCE-* targets
+ Makefile: learn to generate listings for targets requiring special flags
+ Makefile: use target-specific variable to pass flags to cc
+ Makefile: regenerate assembler listings when asked
* jc/maint-1.6.1-checkout-m-custom-merge (2010-01-06) 1 commit
(merged to 'next' on 2010-01-10 at df14116)
+ checkout -m path: fix recreating conflicts
* jh/commit-status (2010-01-13) 2 commits
(merged to 'next' on 2010-01-13 at 0905d59)
+ t7502: test commit.status, --status and --no-status
+ commit: support commit.status, --status, and --no-status
I have already given ample time for people to react, but ended up getting
tired of waiting for tests to materialize and doing it myself, as I want
to close merge window for 1.7.0-rc0 by the end of next week to have the
final release early next month.
* tc/test-locate-httpd (2010-01-02) 1 commit
(merged to 'next' on 2010-01-06 at 9d913e5)
+ t/lib-http.sh: Restructure finding of default httpd location
* js/windows (2010-01-15) 7 commits
- Do not use date.c:tm_to_time_t() from compat/mingw.c
- MSVC: Windows-native implementation for subset of Pthreads API
- MSVC: Fix an "incompatible pointer types" compiler warning
- Windows: avoid the "dup dance" when spawning a child process
- Windows: simplify the pipe(2) implementation
- Windows: boost startup by avoiding a static dependency on shell32.dll
- Windows: disable Python
* dp/maint-1.6.5-fast-import-non-commit-tag (2010-01-14) 1 commit
(merged to 'next' on 2010-01-16 at f95ea8e)
+ fast-import: tag may point to any object type
* nd/include-termios-for-osol (2010-01-11) 1 commit
(merged to 'next' on 2010-01-16 at 3160c76)
+ Add missing #include to support TIOCGWINSZ on Solaris
* pc/uninteresting-submodule-disappear-upon-switch-branches (2010-01-11) 1 commit
(merged to 'next' on 2010-01-16 at b06ca1a)
+ Remove empty directories when checking out a commit with fewer submodules
Instead of using unlink(2) that will never succeed, use rmdir(2) to remove
an empty directory, knowing that this won't harm a populated directory.
* jc/rerere (2009-12-04) 1 commit
(merged to 'next' on 2010-01-10 at e295b7f)
+ Teach --[no-]rerere-autoupdate option to merge, revert and friends
--------------------------------------------------
[New Topics]
* jc/conflict-marker-size (2010-01-16) 8 commits
(merged to 'next' on 2010-01-18 at f1f6023)
+ rerere: honor conflict-marker-size attribute
+ rerere: prepare for customizable conflict marker length
+ conflict-marker-size: new attribute
+ rerere: use ll_merge() instead of using xdl_merge()
+ merge-tree: use ll_merge() not xdl_merge()
+ xdl_merge(): allow passing down marker_size in xmparam_t
+ xdl_merge(): introduce xmparam_t for merge specific parameters
+ git_attr(): fix function signature
(this branch uses jc/cache-unmerge.)
* ag/maint-apply-too-large-p (2010-01-17) 1 commit
(merged to 'next' on 2010-01-18 at 8bd106a)
+ builtin-apply.c: Skip filenames without enough components
* il/rev-namespace (2010-01-19) 2 commits
(merged to 'next' on 2010-01-19 at 2dbc665)
+ Fix errors in t6018
(merged to 'next' on 2010-01-18 at 3e68978)
+ rev-parse --namespace
This probably will be dropped and replaced with the --glob one, perhaps
with minor tweaks.
* jc/grep-author-all-match-implicit (2010-01-17) 1 commit
- "log --author=me --grep=it" should find intersection, not union
* ag/patch-header-verify (2010-01-18) 1 commit
(merged to 'next' on 2010-01-18 at 2cd0ddc)
+ builtin-apply.c: fix the --- and +++ header filename consistency check
* il/branch-set-upstream (2010-01-18) 2 commits
(merged to 'next' on 2010-01-18 at b9b0993)
+ branch: warn and refuse to set a branch as a tracking branch of itself.
+ Add branch --set-upstream
* il/remote-updates (2010-01-18) 1 commit
(merged to 'next' on 2010-01-18 at 5c3e805)
+ Add git remote set-url
* bw/cvsimport (2010-01-19) 3 commits
(merged to 'next' on 2010-01-19 at 63f4c8d)
+ cvsimport: standarize system() calls to external git tools
+ cvsimport: standarize open() calls to external git tools
+ cvsimport: modernize callouts to git subcommands
* jc/checkout-merge-base (2010-01-19) 1 commit
(merged to 'next' on 2010-01-19 at 3665110)
+ Fix "checkout A..." synonym for "checkout A...HEAD" on Windows
* jc/maint-refresh-index-is-optional-for-status (2010-01-19) 1 commit
- status: don't require the repository to be writable
--------------------------------------------------
[Will merge to 'master' soon unless somebody complains]
* rr/core-tutorial (2010-01-16) 1 commit
(merged to 'next' on 2010-01-16 at d9dd8bd)
+ Documentation: Update git core tutorial clarifying reference to scripts
* il/push-set-upstream (2010-01-16) 1 commit
(merged to 'next' on 2010-01-16 at e3a7a60)
+ Add push --set-upstream
* jk/warn-author-committer-after-commit (2010-01-17) 6 commits
(merged to 'next' on 2010-01-17 at c2bb7fd)
+ user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere
+ commit.c::print_summary: do not release the format string too early
(merged to 'next' on 2010-01-16 at f22c077)
+ commit: allow suppression of implicit identity advice
+ commit: show interesting ident information in summary
+ strbuf: add strbuf_addbuf_percentquote
+ strbuf_expand: convert "%%" to "%"
* jc/ident (2010-01-17) 5 commits
(merged to 'next' on 2010-01-19 at 9fba1c0)
+ ident.c: replace fprintf with fputs to suppress compiler warning
(merged to 'next' on 2010-01-17 at 625670d)
+ user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere
+ ident.c: treat $EMAIL as giving user.email identity explicitly
(merged to 'next' on 2010-01-10 at f1f9ded)
+ ident.c: check explicit identity for name and email separately
+ ident.c: remove unused variables
* tr/http-push-ref-status (2010-01-08) 6 commits
(merged to 'next' on 2010-01-16 at 7e872ac)
+ transport-helper.c::push_refs(): emit "no refs" error message
+ transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed
+ transport.c::transport_push(): make ref status affect return value
+ refactor ref status logic for pushing
+ t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs
+ t5541-http-push.sh: add tests for non-fast-forward pushes
* bk/fix-relative-gitdir-file (2010-01-08) 2 commits
(merged to 'next' on 2010-01-16 at cc4ae57)
+ Handle relative paths in submodule .git files
+ Test update-index for a gitlink to a .git file
* sd/cd-p-show-toplevel (2010-01-12) 2 commits
(merged to 'next' on 2010-01-16 at 57d6d31)
+ Use $(git rev-parse --show-toplevel) in cd_to_toplevel().
+ Add 'git rev-parse --show-toplevel' option.
Avoid having to use "cd -P" that may not be available on some platforms'
shells.
* jc/symbol-static (2010-01-18) 17 commits
(merged to 'next' on 2010-01-18 at d063267)
+ Replace parse_blob() with an explanatory comment
+ symlinks.c: remove unused functions
+ object.c: remove unused functions
+ strbuf.c: remove unused function
+ sha1_file.c: remove unused function
+ mailmap.c: remove unused function
(merged to 'next' on 2010-01-17 at d7346b1)
+ utf8.c: mark file-local function static
+ submodule.c: mark file-local function static
+ quote.c: mark file-local function static
+ remote-curl.c: mark file-local function static
+ read-cache.c: mark file-local functions static
+ parse-options.c: mark file-local function static
+ entry.c: mark file-local function static
+ http.c: mark file-local functions static
+ pretty.c: mark file-local function static
+ builtin-rev-list.c: mark file-local function static
+ bisect.c: mark file-local function static
Mark file-local symbols "static", and remove unused functions.
--------------------------------------------------
[Will merge to 'master' after a bit more cooking in 'next']
* nd/status-partial-refresh (2010-01-17) 2 commits
(merged to 'next' on 2010-01-19 at 64f0c0b)
+ rm: only refresh entries that we may touch
(merged to 'next' on 2010-01-16 at f77bc8f)
+ status: only touch path we may need to check
* mh/rebase-fixup (2010-01-14) 23 commits
(merged to 'next' on 2010-01-16 at 7ccb228)
+ rebase -i: Retain user-edited commit messages after squash/fixup conflicts
+ t3404: Set up more of the test repo in the "setup" step
+ rebase -i: For fixup commands without squashes, do not start editor
+ rebase -i: Change function make_squash_message into update_squash_message
+ rebase -i: Extract function do_with_author
+ rebase -i: Handle the author script all in one place in do_next
+ rebase -i: Extract a function "commit_message"
+ rebase -i: Simplify commit counting for generated commit messages
+ rebase -i: Improve consistency of commit count in generated commit messages
+ t3404: Test the commit count in commit messages generated by "rebase -i"
+ rebase -i: Introduce a constant AMEND
+ rebase -i: Introduce a constant AUTHOR_SCRIPT
+ rebase -i: Document how temporary files are used
+ rebase -i: Use symbolic constant $MSG consistently
+ rebase -i: Use "test -n" instead of "test ! -z"
+ rebase -i: Inline expression
+ rebase -i: Remove dead code
+ rebase -i: Make the condition for an "if" more transparent
(merged to 'next' on 2010-01-12 at e84eab0)
+ rebase-i: Ignore comments and blank lines in peek_next_command
+ lib-rebase: Allow comments and blank lines to be added to the rebase script
+ lib-rebase: Provide clearer debugging info about what the editor did
+ Add a command "fixup" to rebase --interactive
+ t3404: Use test_commit to set up test repository
(this branch is used by ns/rebase-auto-squash.)
* ns/rebase-auto-squash (2009-12-08) 1 commit
(merged to 'next' on 2010-01-06 at da4e2f5)
+ rebase -i --autosquash: auto-squash commits
(this branch uses mh/rebase-fixup.)
* da/difftool (2010-01-15) 10 commits
(merged to 'next' on 2010-01-16 at 609f0da)
+ difftool: Update copyright notices to list each year separately
+ difftool: Use eval to expand '--extcmd' expressions
+ difftool: Add '-x' and as an alias for '--extcmd'
+ t7800-difftool.sh: Simplify the --extcmd test
(merged to 'next' on 2010-01-10 at 749c870)
+ git-diff.txt: Link to git-difftool
+ difftool: Allow specifying unconfigured commands with --extcmd
+ difftool--helper: Remove use of the GIT_MERGE_TOOL variable
+ difftool--helper: Update copyright and remove distracting comments
(merged to 'next' on 2010-01-06 at e957395)
+ git-difftool: Add '--gui' for selecting a GUI tool
+ t7800-difftool: Set a bogus tool for use by tests
* mm/conflict-advice (2010-01-12) 1 commit
(merged to 'next' on 2010-01-16 at b83be11)
+ Be more user-friendly when refusing to do something because of conflict.
* jc/maint-strbuf-add-fix-doubling (2010-01-12) 1 commit
(merged to 'next' on 2010-01-16 at 5959eee)
+ strbuf_addbuf(): allow passing the same buf to dst and src
* jc/maint-1.6.4-grep-lookahead (2010-01-10) 1 commit
(merged to 'next' on 2010-01-13 at 20f8f4b)
+ grep: optimize built-in grep by skipping lines that do not hit
(this branch is used by jc/grep-lookahead and jc/maint-grep-lookahead.)
Optimize the "line-by-line" internal grep by skiping en masse over lines
that cannot possibly match.
* jc/maint-grep-lookahead (2010-01-12) 0 commits
(this branch uses jc/maint-1.6.4-grep-lookahead; is used by jc/grep-lookahead.)
Early conflict resolution for the above for recent git.
* jc/grep-lookahead (2010-01-15) 4 commits
(merged to 'next' on 2010-01-17 at 4a5be2d)
+ grep --no-index: allow use of "git grep" outside a git repository
+ grep: prepare to run outside of a work tree
(merged to 'next' on 2010-01-13 at 20f8f4b)
+ grep: rip out pessimization to use fixmatch()
+ grep: rip out support for external grep
(this branch uses jc/maint-1.6.4-grep-lookahead and jc/maint-grep-lookahead.)
* jl/submodule-diff (2010-01-18) 4 commits
- Performance optimization for detection of modified submodules
(merged to 'next' on 2010-01-17 at 525075b)
+ git status: Show uncommitted submodule changes too when enabled
(merged to 'next' on 2010-01-16 at 0a99e3c)
+ Teach diff that modified submodule directory is dirty
+ Show submodules as modified when they contain a dirty work tree
* jc/ls-files-ignored-pathspec (2010-01-08) 4 commits
(merged to 'next' on 2010-01-16 at d36016a)
+ ls-files: fix overeager pathspec optimization
+ read_directory(): further split treat_path()
+ read_directory_recursive(): refactor handling of a single path into a separate function
+ t3001: test ls-files -o ignored/dir
* js/exec-error-report (2010-01-12) 4 commits
(merged to 'next' on 2010-01-16 at 0e28d02)
+ Improve error message when a transport helper was not found
+ start_command: detect execvp failures early
+ run-command: move wait_or_whine earlier
+ start_command: report child process setup errors to the parent's stderr
* jc/fix-tree-walk (2009-09-14) 7 commits
(merged to 'next' on 2010-01-13 at 1c01b87)
+ read-tree --debug-unpack
+ unpack-trees.c: look ahead in the index
+ unpack-trees.c: prepare for looking ahead in the index
+ Aggressive three-way merge: fix D/F case
+ traverse_trees(): handle D/F conflict case sanely
+ more D/F conflict tests
+ tests: move convenience regexp to match object names to test-lib.sh
Resurrected from "Ejected" category. This is fix for a tricky codepath
and testing and improving before it hits 'master' is greatly appreciated.
(I have been using this in my private build for some time).
* jc/cache-unmerge (2009-12-25) 9 commits
(merged to 'next' on 2010-01-13 at 2290c44)
+ rerere forget path: forget recorded resolution
+ rerere: refactor rerere logic to make it independent from I/O
+ rerere: remove silly 1024-byte line limit
+ resolve-undo: teach "update-index --unresolve" to use resolve-undo info
+ resolve-undo: "checkout -m path" uses resolve-undo information
+ resolve-undo: allow plumbing to clear the information
+ resolve-undo: basic tests
+ resolve-undo: record resolved conflicts in a new index extension section
+ builtin-merge.c: use standard active_cache macros
(this branch is used by jc/conflict-marker-size.)
* ap/merge-backend-opts (2008-07-18) 7 commits
(merged to 'next' on 2010-01-18 at cb1f6b7)
+ Document that merge strategies can now take their own options
+ Extend merge-subtree tests to test -Xsubtree=dir.
+ Make "subtree" part more orthogonal to the rest of merge-recursive.
+ pull: Fix parsing of -X<option>
+ Teach git-pull to pass -X<option> to git-merge
+ git merge -X<option>
+ git-merge-file --ours, --theirs
--------------------------------------------------
[Cooking]
* js/refer-upstream (2010-01-19) 3 commits
- Teach @{upstream} syntax to strbuf_branchanme()
- t1506: more test for @{upstream} syntax
- Introduce <branch>@{upstream} notation
Updated to teach the new syntax to commands like "checkout" and "merge"
that want to behave better when they know what were given was a branch
name, not a random SHA-1 or a full refname.
* jh/notes (2010-01-17) 23 commits
- builtin-gc: Teach the new --notes option to garbage-collect notes
- Notes API: gc_notes(): Prune notes that belong to non-existing objects
- t3305: Verify that removing notes triggers automatic fanout consolidation
- builtin-notes: Teach -d option for deleting existing notes
- Teach builtin-notes to remove empty notes
- Teach notes code to properly preserve non-notes in the notes tree
- t3305: Verify that adding many notes with git-notes triggers increased fanout
- t3301: Verify successful annotation of non-commits
- Builtin-ify git-notes
- Refactor notes concatenation into a flexible interface for combining notes
- Notes API: Allow multiple concurrent notes trees with new struct notes_tree
- Notes API: write_notes_tree(): Store the notes tree in the database
- Notes API: for_each_note(): Traverse the entire notes tree with a callback
- Notes API: get_note(): Return the note annotating the given object
- Notes API: remove_note(): Remove note objects from the notes tree structure
- Notes API: add_note(): Add note objects to the internal notes tree structure
- Notes API: init_notes(): Initialize the notes tree from the given notes ref
- Add tests for checking correct handling of $GIT_NOTES_REF and core.notesRef
- Notes API: get_commit_notes() -> format_note() + remove the commit restriction
- Minor non-functional fixes to notes.c
(merged to 'next' on 2010-01-02 at ae42130)
+ Add more testcases to test fast-import of notes
+ Rename t9301 to t9350, to make room for more fast-import tests
+ fast-import: Proper notes tree manipulation
Updated with a re-roll.
* jh/gitweb-cached (2010-01-13) 9 commits
- gitweb: File based caching layer (from git.kernel.org)
- gitweb: Convert output to using indirect file handle
- gitweb: cleanup error message produced by undefined $site_header
- gitweb: add a get function to compliment print_sort_th
- gitweb: add a get function to compliment print_local_time
- gitweb: Makefile improvements
- gitweb: Add option to force version match
- gitweb: change die_error to take "extra" argument for extended die information
- gitweb: Load checking
Replaced with a re-roll. Update to t9500 is probably needed.
* jc/branch-d (2009-12-29) 1 commit
(merged to 'next' on 2010-01-10 at 61a14b7)
+ branch -d: base the "already-merged" safety on the branch it merges with
^ permalink raw reply
* Re: [PATCH 2/2] rev-parse --branches/--tags/--remotes=pattern
From: Junio C Hamano @ 2010-01-20 10:18 UTC (permalink / raw)
To: Ilari Liusvaara; +Cc: git
In-Reply-To: <1263980906-11058-2-git-send-email-ilari.liusvaara@elisanet.fi>
Ilari Liusvaara <ilari.liusvaara@elisanet.fi> writes:
> Since local branch, tags and remote tracking branch namespaces are
> most often used, add shortcut notations for globbing those in
> manner similar to --glob option.
>
> With this, one can express the "what I have but origin doesn't?"
> as:
>
> 'git log --branches --not --remotes=origin'
>
> Original-idea-by: Johannes Sixt <j6t@kdbg.org>
> Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
> ---
Nice.
^ permalink raw reply
* Re: [PATCH 1/2] rev-parse --glob
From: Junio C Hamano @ 2010-01-20 10:17 UTC (permalink / raw)
To: Ilari Liusvaara; +Cc: git
In-Reply-To: <1263980906-11058-1-git-send-email-ilari.liusvaara@elisanet.fi>
Ilari Liusvaara <ilari.liusvaara@elisanet.fi> writes:
> Add --glob=<glob-pattern> option to rev-parse and everything that
> accepts its options. This option matches all refs that match given
> shell glob pattern (complete with some DWIM logic).
>
> Example:
>
> 'git log --branches --not --glob=remotes/origin'
>
> To show what you have that origin doesn't.
>
> Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
> ---
Looks fairly competently done. Does this mean you've abandoned the --namespace
series? I don't mind reverting them from 'next'.
> +static int filter_refs(const char* ref, const unsigned char *sha, int flags,
> + void* data)
> +{
> + struct ref_filter *filter = (struct ref_filter*)data;
> + if (fnmatch(filter->pattern, ref, 0))
> + return 0;
In many places (not just refs) we use "If leading path component matches,
or fnmatch() says Ok" (e.g. builtin-for-each-ref.c, builtin_grep.c), and
in some other places we only use fnmatch(). I think it is better to pick
one convention, and adjust the other one to match, and my gut feeling is
that "leading path or fnmatch()", while theologically might be messier,
would be more useful in practice. And that was why I did my "like this"
patch http://article.gmane.org/gmane.comp.version-control.git/137492 that way.
My longer term desire is to consolidate these fnmatch() users to call a
single helper function, and then perhaps replace fnmatch() in that helper
function with something more powerful. Although I do not personally care
too much, people often wanted to have "path/**/leaf-that-is-deep" matcher.
I don't want you to go there just yet with this series, but at least
following the same style everywhere would pave the way to consolidating
them.
> @@ -674,6 +691,35 @@ int for_each_replace_ref(each_ref_fn fn, void *cb_data)
> return do_for_each_ref("refs/replace/", fn, 13, 0, cb_data);
> }
>
> +int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
> +{
> + struct strbuf real_pattern = STRBUF_INIT;
> + struct ref_filter filter;
> + const char *has_glob_specials;
> + int ret;
> +
> + if (prefixcmp(pattern, "refs/"))
> + strbuf_addstr(&real_pattern, "refs/");
> + strbuf_addstr(&real_pattern, pattern);
> +
> + has_glob_specials = strpbrk(pattern, "?*[");
Would the need for this code hopefully disappear if we take the "leading
path or fnmatch()" check? If we still need this, we probably would want
to add a has_glob_special() helper function not as a hardcoded srpbrk(),
but in terms of is_glob_special() in git-compat-util.h.
Thanks.
^ permalink raw reply
* Re: [RFC/PATCHv8 00/10] git notes
From: Alex Riesen @ 2010-01-20 10:06 UTC (permalink / raw)
To: Junio C Hamano
Cc: Johannes Sixt, Nanako Shiraishi, Johan Herland, git, spearce
In-Reply-To: <7vska15u92.fsf@alter.siamese.dyndns.org>
On Wed, Jan 20, 2010 at 04:29, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>>> This breaks "checkout to merge base" on Windows and t2012 in particular.
>
> I think the attached patch would help. If this fix is Ok with Windows
FWIW, I confirm that it does. The test passes.
^ permalink raw reply
* Re: git locate
From: Jakub Narebski @ 2010-01-20 10:06 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: John Tapsell, Git List
In-Reply-To: <alpine.DEB.1.00.1001201021060.31129@intel-tinevez-2-302>
On Wed, 20 Jan 2010, Johannes Schindelin wrote:
> On Tue, 19 Jan 2010, Jakub Narebski wrote:
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>> On Wed, 20 Jan 2010, John Tapsell wrote:
>>>
>>>> Could we add a: git locate <filename> or git find <filename>
>>>
>>> How about "git ls-files \*<filename>"?
>>
>> Or "git ls-files '*filename'...
>>
>> ... but how to make an (git) alias for this?
>
> Add something like this to your $HOME/.gitconfig:
>
> [alias]
> locate = !sh -c 'git ls-files "\\*$1"' -
Thanks a lot, Dscho!
I think it would be nice to have this trick
alias.<cmd> = !sh -c '<commands with $1, $@, $#>' -
described in git-config (alias) documentation. Unfortunately I don't
understand this trick well enough to do it myself...
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: git notes: notes
From: Thomas Rast @ 2010-01-20 9:48 UTC (permalink / raw)
To: Joey Hess; +Cc: git
In-Reply-To: <20100120050343.GA12860@gnu.kitenet.net>
Joey Hess wrote:
> Just a quick note that the new notes feature can break things that parse
> git log.
Umm. git-log is porcelain and we're allowed to change it. Worse,
even the user can change it in very significant ways, just try:
git config format.pretty email
git log
For a better alternative, I'm afraid you'll either have to look to
git-rev-list (which also takes --pretty) or 'git cat-file --batch'.
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply
* [PATCH 2/2] rev-parse --branches/--tags/--remotes=pattern
From: Ilari Liusvaara @ 2010-01-20 9:48 UTC (permalink / raw)
To: git
In-Reply-To: <1263980906-11058-1-git-send-email-ilari.liusvaara@elisanet.fi>
Since local branch, tags and remote tracking branch namespaces are
most often used, add shortcut notations for globbing those in
manner similar to --glob option.
With this, one can express the "what I have but origin doesn't?"
as:
'git log --branches --not --remotes=origin'
Original-idea-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
---
Builds on top of --glob patch.
Documentation/git-log.txt | 4 +-
Documentation/git-rev-list.txt | 6 ++--
Documentation/git-rev-parse.txt | 19 +++++++---
Documentation/rev-list-options.txt | 18 +++++++---
builtin-rev-parse.c | 18 ++++++++++
refs.c | 12 ++++++-
refs.h | 1 +
revision.c | 18 ++++++++++
t/t6018-rev-list-glob.sh | 62 +++++++++++++++++++++++++++++++++++-
9 files changed, 138 insertions(+), 20 deletions(-)
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 0b874e3..0acd526 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -107,13 +107,13 @@ git log --follow builtin-rev-list.c::
those commits that occurred before the file was given its
present name.
-git log --branches --not --glob=remotes/origin/*::
+git log --branches --not --remotes=origin::
Shows all commits that are in any of local branches but not in
any of remote tracking branches for 'origin' (what you have that
origin doesn't).
-git log master --not --glob=remotes/*/master::
+git log master --not --remotes=*/master::
Shows all commits that are in local master but not in any remote
repository master branches.
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 33122a3..f857116 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -21,9 +21,9 @@ SYNOPSIS
[ \--full-history ]
[ \--not ]
[ \--all ]
- [ \--branches ]
- [ \--tags ]
- [ \--remotes ]
+ [ \--branches[=pattern] ]
+ [ \--tags=[pattern] ]
+ [ \--remotes=[pattern] ]
[ \--glob=glob-pattern ]
[ \--stdin ]
[ \--quiet ]
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 6eb8c14..afe8699 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -103,14 +103,21 @@ OPTIONS
--all::
Show all refs found in `$GIT_DIR/refs`.
---branches::
- Show branch refs found in `$GIT_DIR/refs/heads`.
+--branches[=pattern]::
+ Show branch refs found in `$GIT_DIR/refs/heads`. If `pattern`
+ is given, only branches matching given shell glob are shown.
+ If pattern lacks '?', '*', or '[', '/*' at the end is impiled.
---tags::
- Show tag refs found in `$GIT_DIR/refs/tags`.
+--tags[=pattern]::
+ Show tag refs found in `$GIT_DIR/refs/tags`. If `pattern`
+ is given, only tags matching given shell glob are shown.
+ If pattern lacks '?', '*', or '[', '/*' at the end is impiled.
---remotes::
- Show tag refs found in `$GIT_DIR/refs/remotes`.
+--remotes[=pattern]::
+ Show tag refs found in `$GIT_DIR/refs/remotes`. If `pattern`
+ is given, only remote tracking branches matching given shell glob
+ are shown. If pattern lacks '?', '*', or '[', '/*' at the end is
+ impiled.
--glob=glob-pattern::
Show refs matching shell glob pattern `glob-pattern`. If pattern
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 6d03c17..3ef7117 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -228,20 +228,26 @@ endif::git-rev-list[]
Pretend as if all the refs in `$GIT_DIR/refs/` are listed on the
command line as '<commit>'.
---branches::
+--branches[=pattern]::
Pretend as if all the refs in `$GIT_DIR/refs/heads` are listed
- on the command line as '<commit>'.
+ on the command line as '<commit>'. If `pattern` is given, limit
+ branches to ones matching given shell glob. If pattern lacks '?',
+ '*', or '[', '/*' at the end is impiled.
---tags::
+--tags[=pattern]::
Pretend as if all the refs in `$GIT_DIR/refs/tags` are listed
- on the command line as '<commit>'.
+ on the command line as '<commit>'. If `pattern` is given, limit
+ tags to ones matching given shell glob. If pattern lacks '?', '*',
+ or '[', '/*' at the end is impiled.
---remotes::
+--remotes[=pattern]::
Pretend as if all the refs in `$GIT_DIR/refs/remotes` are listed
- on the command line as '<commit>'.
+ on the command line as '<commit>'. If `pattern`is given, limit
+ remote tracking branches to ones matching given shell glob.
+ If pattern lacks '?', '*', or '[', '/*' at the end is impiled.
--glob=glob-pattern::
Pretend as if all the refs matching shell glob `glob-pattern`
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index a635dde..d14fe20 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -41,6 +41,7 @@ static int is_rev_argument(const char *arg)
"--all",
"--bisect",
"--dense",
+ "--branches=",
"--branches",
"--header",
"--max-age=",
@@ -51,9 +52,11 @@ static int is_rev_argument(const char *arg)
"--objects-edge",
"--parents",
"--pretty",
+ "--remotes=",
"--remotes",
"--glob=",
"--sparse",
+ "--tags=",
"--tags",
"--topo-order",
"--date-order",
@@ -570,10 +573,20 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
for_each_ref_in("refs/bisect/good", anti_reference, NULL);
continue;
}
+ if (!prefixcmp(arg, "--branches=")) {
+ for_each_glob_ref_in(show_reference, arg + 11,
+ "refs/heads/", NULL);
+ continue;
+ }
if (!strcmp(arg, "--branches")) {
for_each_branch_ref(show_reference, NULL);
continue;
}
+ if (!prefixcmp(arg, "--tags=")) {
+ for_each_glob_ref_in(show_reference, arg + 7,
+ "refs/tags/", NULL);
+ continue;
+ }
if (!strcmp(arg, "--tags")) {
for_each_tag_ref(show_reference, NULL);
continue;
@@ -582,6 +595,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
for_each_glob_ref(show_reference, arg + 7, NULL);
continue;
}
+ if (!prefixcmp(arg, "--remotes=")) {
+ for_each_glob_ref_in(show_reference, arg + 10,
+ "refs/remotes/", NULL);
+ continue;
+ }
if (!strcmp(arg, "--remotes")) {
for_each_remote_ref(show_reference, NULL);
continue;
diff --git a/refs.c b/refs.c
index 5adf69c..af78c31 100644
--- a/refs.c
+++ b/refs.c
@@ -691,15 +691,18 @@ int for_each_replace_ref(each_ref_fn fn, void *cb_data)
return do_for_each_ref("refs/replace/", fn, 13, 0, cb_data);
}
-int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
+int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
+ const char *prefix, void *cb_data)
{
struct strbuf real_pattern = STRBUF_INIT;
struct ref_filter filter;
const char *has_glob_specials;
int ret;
- if (prefixcmp(pattern, "refs/"))
+ if (!prefix && prefixcmp(pattern, "refs/"))
strbuf_addstr(&real_pattern, "refs/");
+ else if (prefix)
+ strbuf_addstr(&real_pattern, prefix);
strbuf_addstr(&real_pattern, pattern);
has_glob_specials = strpbrk(pattern, "?*[");
@@ -720,6 +723,11 @@ int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
return ret;
}
+int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
+{
+ return for_each_glob_ref_in(fn, pattern, NULL, cb_data);
+}
+
int for_each_rawref(each_ref_fn fn, void *cb_data)
{
return do_for_each_ref("refs/", fn, 0,
diff --git a/refs.h b/refs.h
index 78ad173..f7648b9 100644
--- a/refs.h
+++ b/refs.h
@@ -26,6 +26,7 @@ extern int for_each_branch_ref(each_ref_fn, void *);
extern int for_each_remote_ref(each_ref_fn, void *);
extern int for_each_replace_ref(each_ref_fn, void *);
extern int for_each_glob_ref(each_ref_fn, const char *pattern, void *);
+extern int for_each_glob_ref_in(each_ref_fn, const char *pattern, const char* prefix, void *);
/* can be used to learn about broken ref and symref */
extern int for_each_rawref(each_ref_fn, void *);
diff --git a/revision.c b/revision.c
index 162b182..1e9277d 100644
--- a/revision.c
+++ b/revision.c
@@ -1364,6 +1364,24 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
for_each_glob_ref(handle_one_ref, arg + 7, &cb);
continue;
}
+ if (!prefixcmp(arg, "--branches=")) {
+ struct all_refs_cb cb;
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_glob_ref_in(handle_one_ref, arg + 11, "refs/heads/", &cb);
+ continue;
+ }
+ if (!prefixcmp(arg, "--tags=")) {
+ struct all_refs_cb cb;
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_glob_ref_in(handle_one_ref, arg + 7, "refs/tags/", &cb);
+ continue;
+ }
+ if (!prefixcmp(arg, "--remotes=")) {
+ struct all_refs_cb cb;
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_glob_ref_in(handle_one_ref, arg + 10, "refs/remotes/", &cb);
+ continue;
+ }
if (!strcmp(arg, "--reflog")) {
handle_reflog(revs, flags);
continue;
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh
index 0d7e4bc..bf85e0c 100755
--- a/t/t6018-rev-list-glob.sh
+++ b/t/t6018-rev-list-glob.sh
@@ -33,7 +33,9 @@ test_expect_success 'setup' '
git checkout -b someref master &&
commit some &&
git checkout master &&
- commit master2
+ commit master2 &&
+ git tag foo/bar master &&
+ git update-ref refs/remotes/foo/baz master
'
test_expect_success 'rev-parse --glob=refs/heads/subspace/*' '
@@ -66,6 +68,24 @@ test_expect_success 'rev-parse --glob=heads/subspace' '
'
+test_expect_success 'rev-parse --branches=subspace/*' '
+
+ compare rev-parse "subspace/one subspace/two" "--branches=subspace/*"
+
+'
+
+test_expect_success 'rev-parse --branches=subspace/' '
+
+ compare rev-parse "subspace/one subspace/two" "--branches=subspace/"
+
+'
+
+test_expect_success 'rev-parse --branches=subspace' '
+
+ compare rev-parse "subspace/one subspace/two" "--branches=subspace"
+
+'
+
test_expect_success 'rev-parse --glob=heads/subspace/* --glob=heads/other/*' '
compare rev-parse "subspace/one subspace/two other/three" "--glob=heads/subspace/* --glob=heads/other/*"
@@ -84,6 +104,18 @@ test_expect_success 'rev-parse --glob=heads/*' '
'
+test_expect_success 'rev-parse --tags=foo' '
+
+ compare rev-parse "foo/bar" "--tags=foo"
+
+'
+
+test_expect_success 'rev-parse --remotes=foo' '
+
+ compare rev-parse "foo/baz" "--remotes=foo"
+
+'
+
test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/*"
@@ -114,6 +146,23 @@ test_expect_success 'rev-list --glob=heads/subspace' '
'
+test_expect_success 'rev-list --branches=subspace/*' '
+
+ compare rev-list "subspace/one subspace/two" "--branches=subspace/*"
+
+'
+
+test_expect_success 'rev-list --branches=subspace/' '
+
+ compare rev-list "subspace/one subspace/two" "--branches=subspace/"
+
+'
+
+test_expect_success 'rev-list --branches=subspace' '
+
+ compare rev-list "subspace/one subspace/two" "--branches=subspace"
+
+'
test_expect_success 'rev-list --glob=heads/someref/* master' '
compare rev-list "master" "--glob=heads/someref/* master"
@@ -132,5 +181,16 @@ test_expect_success 'rev-list --glob=heads/*' '
'
+test_expect_success 'rev-list --tags=foo' '
+
+ compare rev-list "foo/bar" "--tags=foo"
+
+'
+
+test_expect_success 'rev-list --remotes=foo' '
+
+ compare rev-list "foo/baz" "--remotes=foo"
+
+'
test_done
--
1.6.6.199.gff4b0
^ permalink raw reply related
* [PATCH 1/2] rev-parse --glob
From: Ilari Liusvaara @ 2010-01-20 9:48 UTC (permalink / raw)
To: git
Add --glob=<glob-pattern> option to rev-parse and everything that
accepts its options. This option matches all refs that match given
shell glob pattern (complete with some DWIM logic).
Example:
'git log --branches --not --glob=remotes/origin'
To show what you have that origin doesn't.
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
---
--glob can do everything --namespace did and more (in fact, what
was valid for --namespace is valid for --glob and even means the same
thing). Built on top of master.
Documentation/git-log.txt | 11 +++
Documentation/git-rev-list.txt | 1 +
Documentation/git-rev-parse.txt | 5 ++
Documentation/rev-list-options.txt | 7 ++
builtin-rev-parse.c | 5 ++
refs.c | 46 ++++++++++++
refs.h | 1 +
revision.c | 16 ++++-
t/t6018-rev-list-glob.sh | 136 ++++++++++++++++++++++++++++++++++++
9 files changed, 226 insertions(+), 2 deletions(-)
create mode 100755 t/t6018-rev-list-glob.sh
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 3d79de1..0b874e3 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -107,6 +107,17 @@ git log --follow builtin-rev-list.c::
those commits that occurred before the file was given its
present name.
+git log --branches --not --glob=remotes/origin/*::
+
+ Shows all commits that are in any of local branches but not in
+ any of remote tracking branches for 'origin' (what you have that
+ origin doesn't).
+
+git log master --not --glob=remotes/*/master::
+
+ Shows all commits that are in local master but not in any remote
+ repository master branches.
+
Discussion
----------
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 3341d1b..33122a3 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -24,6 +24,7 @@ SYNOPSIS
[ \--branches ]
[ \--tags ]
[ \--remotes ]
+ [ \--glob=glob-pattern ]
[ \--stdin ]
[ \--quiet ]
[ \--topo-order ]
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 82045a2..6eb8c14 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -112,6 +112,11 @@ OPTIONS
--remotes::
Show tag refs found in `$GIT_DIR/refs/remotes`.
+--glob=glob-pattern::
+ Show refs matching shell glob pattern `glob-pattern`. If pattern
+ specified lacks leading 'refs/', it is automatically prepended.
+ If pattern lacks '?', '*', or '[', '/*' at the end is impiled.
+
--show-prefix::
When the command is invoked from a subdirectory, show the
path of the current directory relative to the top-level
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 1f57aed..6d03c17 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -243,6 +243,13 @@ endif::git-rev-list[]
Pretend as if all the refs in `$GIT_DIR/refs/remotes` are listed
on the command line as '<commit>'.
+--glob=glob-pattern::
+ Pretend as if all the refs matching shell glob `glob-pattern`
+ are listed on the command line as '<commit>'. Leading 'refs/',
+ is automatically prepended if missing. If pattern lacks '?', '*',
+ or '[', '/*' at the end is impiled.
+
+
ifndef::git-rev-list[]
--bisect::
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 37d0233..a635dde 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -52,6 +52,7 @@ static int is_rev_argument(const char *arg)
"--parents",
"--pretty",
"--remotes",
+ "--glob=",
"--sparse",
"--tags",
"--topo-order",
@@ -577,6 +578,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
for_each_tag_ref(show_reference, NULL);
continue;
}
+ if (!prefixcmp(arg, "--glob=")) {
+ for_each_glob_ref(show_reference, arg + 7, NULL);
+ continue;
+ }
if (!strcmp(arg, "--remotes")) {
for_each_remote_ref(show_reference, NULL);
continue;
diff --git a/refs.c b/refs.c
index 3e73a0a..5adf69c 100644
--- a/refs.c
+++ b/refs.c
@@ -519,6 +519,14 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
return ref;
}
+/* The argument to filter_refs */
+struct ref_filter
+{
+ const char *pattern;
+ each_ref_fn *fn;
+ void *cb_data;
+};
+
int read_ref(const char *ref, unsigned char *sha1)
{
if (resolve_ref(ref, sha1, 1, NULL))
@@ -545,6 +553,15 @@ static int do_one_ref(const char *base, each_ref_fn fn, int trim,
return fn(entry->name + trim, entry->sha1, entry->flag, cb_data);
}
+static int filter_refs(const char* ref, const unsigned char *sha, int flags,
+ void* data)
+{
+ struct ref_filter *filter = (struct ref_filter*)data;
+ if (fnmatch(filter->pattern, ref, 0))
+ return 0;
+ return filter->fn(ref, sha, flags, filter->cb_data);
+}
+
int peel_ref(const char *ref, unsigned char *sha1)
{
int flag;
@@ -674,6 +691,35 @@ int for_each_replace_ref(each_ref_fn fn, void *cb_data)
return do_for_each_ref("refs/replace/", fn, 13, 0, cb_data);
}
+int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)
+{
+ struct strbuf real_pattern = STRBUF_INIT;
+ struct ref_filter filter;
+ const char *has_glob_specials;
+ int ret;
+
+ if (prefixcmp(pattern, "refs/"))
+ strbuf_addstr(&real_pattern, "refs/");
+ strbuf_addstr(&real_pattern, pattern);
+
+ has_glob_specials = strpbrk(pattern, "?*[");
+ if (!has_glob_specials) {
+ /* Append impiled '/' '*' if not present. */
+ if (real_pattern.buf[real_pattern.len - 1] != '/')
+ strbuf_addch(&real_pattern, '/');
+ /* No need to check for '*', there is none. */
+ strbuf_addch(&real_pattern, '*');
+ }
+
+ filter.pattern = real_pattern.buf;
+ filter.fn = fn;
+ filter.cb_data = cb_data;
+ ret = for_each_ref(filter_refs, &filter);
+
+ strbuf_release(&real_pattern);
+ return ret;
+}
+
int for_each_rawref(each_ref_fn fn, void *cb_data)
{
return do_for_each_ref("refs/", fn, 0,
diff --git a/refs.h b/refs.h
index e141991..78ad173 100644
--- a/refs.h
+++ b/refs.h
@@ -25,6 +25,7 @@ extern int for_each_tag_ref(each_ref_fn, void *);
extern int for_each_branch_ref(each_ref_fn, void *);
extern int for_each_remote_ref(each_ref_fn, void *);
extern int for_each_replace_ref(each_ref_fn, void *);
+extern int for_each_glob_ref(each_ref_fn, const char *pattern, void *);
/* can be used to learn about broken ref and symref */
extern int for_each_rawref(each_ref_fn, void *);
diff --git a/revision.c b/revision.c
index 25fa14d..162b182 100644
--- a/revision.c
+++ b/revision.c
@@ -699,12 +699,18 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
return 0;
}
+static void init_all_refs_cb(struct all_refs_cb *cb, struct rev_info *revs,
+ unsigned flags)
+{
+ cb->all_revs = revs;
+ cb->all_flags = flags;
+}
+
static void handle_refs(struct rev_info *revs, unsigned flags,
int (*for_each)(each_ref_fn, void *))
{
struct all_refs_cb cb;
- cb.all_revs = revs;
- cb.all_flags = flags;
+ init_all_refs_cb(&cb, revs, flags);
for_each(handle_one_ref, &cb);
}
@@ -1352,6 +1358,12 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
handle_refs(revs, flags, for_each_remote_ref);
continue;
}
+ if (!prefixcmp(arg, "--glob=")) {
+ struct all_refs_cb cb;
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_glob_ref(handle_one_ref, arg + 7, &cb);
+ continue;
+ }
if (!strcmp(arg, "--reflog")) {
handle_reflog(revs, flags);
continue;
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh
new file mode 100755
index 0000000..0d7e4bc
--- /dev/null
+++ b/t/t6018-rev-list-glob.sh
@@ -0,0 +1,136 @@
+#!/bin/sh
+
+test_description='rev-list/rev-parse --glob'
+
+. ./test-lib.sh
+
+
+commit () {
+ test_tick &&
+ echo $1 > foo &&
+ git add foo &&
+ git commit -m "$1"
+}
+
+compare () {
+ # Split arguments on whitespace.
+ git $1 $2 >expected &&
+ git $1 $3 >actual &&
+ test_cmp expected actual
+}
+
+test_expect_success 'setup' '
+
+ commit master &&
+ git checkout -b subspace/one master &&
+ commit one &&
+ git checkout -b subspace/two master &&
+ commit two &&
+ git checkout -b subspace-x master &&
+ commit subspace-x &&
+ git checkout -b other/three master &&
+ commit three &&
+ git checkout -b someref master &&
+ commit some &&
+ git checkout master &&
+ commit master2
+'
+
+test_expect_success 'rev-parse --glob=refs/heads/subspace/*' '
+
+ compare rev-parse "subspace/one subspace/two" "--glob=refs/heads/subspace/*"
+
+'
+
+test_expect_success 'rev-parse --glob=heads/subspace/*' '
+
+ compare rev-parse "subspace/one subspace/two" "--glob=heads/subspace/*"
+
+'
+
+test_expect_success 'rev-parse --glob=refs/heads/subspace/' '
+
+ compare rev-parse "subspace/one subspace/two" "--glob=refs/heads/subspace/"
+
+'
+
+test_expect_success 'rev-parse --glob=heads/subspace/' '
+
+ compare rev-parse "subspace/one subspace/two" "--glob=heads/subspace/"
+
+'
+
+test_expect_success 'rev-parse --glob=heads/subspace' '
+
+ compare rev-parse "subspace/one subspace/two" "--glob=heads/subspace"
+
+'
+
+test_expect_success 'rev-parse --glob=heads/subspace/* --glob=heads/other/*' '
+
+ compare rev-parse "subspace/one subspace/two other/three" "--glob=heads/subspace/* --glob=heads/other/*"
+
+'
+
+test_expect_success 'rev-parse --glob=heads/someref/* master' '
+
+ compare rev-parse "master" "--glob=heads/someref/* master"
+
+'
+
+test_expect_success 'rev-parse --glob=heads/*' '
+
+ compare rev-parse "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*"
+
+'
+
+test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
+
+ compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/*"
+
+'
+
+test_expect_success 'rev-list --glob=heads/subspace/*' '
+
+ compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/*"
+
+'
+
+test_expect_success 'rev-list --glob=refs/heads/subspace/' '
+
+ compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/"
+
+'
+
+test_expect_success 'rev-list --glob=heads/subspace/' '
+
+ compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/"
+
+'
+
+test_expect_success 'rev-list --glob=heads/subspace' '
+
+ compare rev-list "subspace/one subspace/two" "--glob=heads/subspace"
+
+'
+
+test_expect_success 'rev-list --glob=heads/someref/* master' '
+
+ compare rev-list "master" "--glob=heads/someref/* master"
+
+'
+
+test_expect_success 'rev-list --glob=heads/subspace/* --glob=heads/other/*' '
+
+ compare rev-list "subspace/one subspace/two other/three" "--glob=heads/subspace/* --glob=heads/other/*"
+
+'
+
+test_expect_success 'rev-list --glob=heads/*' '
+
+ compare rev-list "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*"
+
+'
+
+
+test_done
--
1.6.6.199.gff4b0
^ permalink raw reply related
* [PATCH 2/2] Teach @{upstream} syntax to strbuf_branchanme()
From: Junio C Hamano @ 2010-01-20 9:38 UTC (permalink / raw)
To: git; +Cc: Jeff King, Johannes Schindelin
In-Reply-To: <1263980322-4142-1-git-send-email-gitster@pobox.com>
This teaches @{upstream} syntax to interpret_branch_name(), instead
of dwim_ref() machinery.
There are places in git UI that behaves differently when you give a local
branch name and when you give an extended SHA-1 expression that evaluates
to the commit object name at the tip of the branch. The intent is that
the special syntax such as @{-1} can stand in as if the user spelled the
name of the branch in such places.
The name of the branch "frotz" to switch to ("git checkout frotz"), and
the name of the branch "nitfol" to fork a new branch "frotz" from ("git
checkout -b frotz nitfol"), are examples of such places. These places
take only the name of the branch (e.g. "frotz"), and they are supposed to
act differently to an equivalent refname (e.g. "refs/heads/frotz"), so
hooking the @{upstream} and @{-N} syntax to dwim_ref() is insufficient
when we want to deal with cases a local branch is forked from another
local branch and use "forked@{upstream}" to name the forkee branch.
The "upstream" syntax "forked@{u}" is to specify the ref that "forked" is
configured to merge with, and most often the forkee is a remote tracking
branch, not a local branch. We cannot simply return a local branch name,
but that does not necessarily mean we have to returns the full refname
(e.g. refs/remotes/origin/frotz, when returning origin/frotz is enough).
This update calls shorten_unambiguous_ref() to do so.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
sha1_name.c | 116 ++++++++++++++++++++++++++---------------
t/t1506-rev-parse-upstream.sh | 6 +-
2 files changed, 77 insertions(+), 45 deletions(-)
diff --git a/sha1_name.c b/sha1_name.c
index fb4e214..2376c6d 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -239,24 +239,10 @@ static int ambiguous_path(const char *path, int len)
return slash;
}
-static inline int tracked_suffix(const char *string, int len)
-{
- const char *suffix[] = { "@{upstream}", "@{u}" };
- int i;
-
- for (i = 0; i < ARRAY_SIZE(suffix); i++) {
- int suffix_len = strlen(suffix[i]);
- if (len >= suffix_len && !memcmp(string + len - suffix_len,
- suffix[i], suffix_len))
- return suffix_len;
- }
- return 0;
-}
-
/*
* *string and *len will only be substituted, and *string returned (for
- * later free()ing) if the string passed in is of the form @{-<n>} or
- * of the form <branch>@{upstream}.
+ * later free()ing) if the string passed in is a magic short-hand form
+ * to name a branch.
*/
static char *substitute_branch_name(const char **string, int *len)
{
@@ -270,21 +256,6 @@ static char *substitute_branch_name(const char **string, int *len)
return (char *)*string;
}
- ret = tracked_suffix(*string, *len);
- if (ret) {
- char *ref = xstrndup(*string, *len - ret);
- struct branch *tracking = branch_get(*ref ? ref : NULL);
-
- if (!tracking)
- die ("No tracking branch found for '%s'", ref);
- free(ref);
- if (tracking->merge && tracking->merge[0]->dst) {
- *string = xstrdup(tracking->merge[0]->dst);
- *len = strlen(*string);
- return (char *)*string;
- }
- }
-
return NULL;
}
@@ -354,6 +325,20 @@ int dwim_log(const char *str, int len, unsigned char *sha1, char **log)
return logs_found;
}
+static inline int upstream_mark(const char *string, int len)
+{
+ const char *suffix[] = { "@{upstream}", "@{u}" };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(suffix); i++) {
+ int suffix_len = strlen(suffix[i]);
+ if (suffix_len <= len
+ && !memcmp(string, suffix[i], suffix_len))
+ return suffix_len;
+ }
+ return 0;
+}
+
static int get_sha1_1(const char *name, int len, unsigned char *sha1);
static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
@@ -371,7 +356,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
if (len && str[len-1] == '}') {
for (at = len-2; at >= 0; at--) {
if (str[at] == '@' && str[at+1] == '{') {
- if (!tracked_suffix(str + at, len - at)) {
+ if (!upstream_mark(str + at, len - at)) {
reflog_len = (len-1) - (at+2);
len = at;
}
@@ -773,17 +758,10 @@ static int grab_nth_branch_switch(unsigned char *osha1, unsigned char *nsha1,
}
/*
- * This reads "@{-N}" syntax, finds the name of the Nth previous
- * branch we were on, and places the name of the branch in the given
- * buf and returns the number of characters parsed if successful.
- *
- * If the input is not of the accepted format, it returns a negative
- * number to signal an error.
- *
- * If the input was ok but there are not N branch switches in the
- * reflog, it returns 0.
+ * Parse @{-N} syntax, return the number of characters parsed
+ * if successful; otherwise signal an error with negative value.
*/
-int interpret_branch_name(const char *name, struct strbuf *buf)
+static int interpret_nth_prior_checkout(const char *name, struct strbuf *buf)
{
long nth;
int i, retval;
@@ -828,6 +806,60 @@ release_return:
}
/*
+ * This reads short-hand syntax that not only evaluates to a commit
+ * object name, but also can act as if the end user spelled the name
+ * of the branch from the command line.
+ *
+ * - "@{-N}" finds the name of the Nth previous branch we were on, and
+ * places the name of the branch in the given buf and returns the
+ * number of characters parsed if successful.
+ *
+ * - "<branch>@{upstream}" finds the name of the other ref that
+ * <branch> is configured to merge with (missing <branch> defaults
+ * to the current branch), and places the name of the branch in the
+ * given buf and returns the number of characters parsed if
+ * successful.
+ *
+ * If the input is not of the accepted format, it returns a negative
+ * number to signal an error.
+ *
+ * If the input was ok but there are not N branch switches in the
+ * reflog, it returns 0.
+ */
+int interpret_branch_name(const char *name, struct strbuf *buf)
+{
+ char *cp;
+ struct branch *upstream;
+ int namelen = strlen(name);
+ int len = interpret_nth_prior_checkout(name, buf);
+ int tmp_len;
+
+ if (!len)
+ return len; /* syntax Ok, not enough switches */
+ if (0 < len)
+ return len; /* consumed from the front */
+ cp = strchr(name, '@');
+ if (!cp)
+ return -1;
+ tmp_len = upstream_mark(cp, namelen - (cp - name));
+ if (!tmp_len)
+ return -1;
+ len = cp + tmp_len - name;
+ cp = xstrndup(name, cp - name);
+ upstream = branch_get(*cp ? cp : NULL);
+ if (!upstream
+ || !upstream->merge
+ || !upstream->merge[0]->dst)
+ return error("No upstream branch found for '%s'", cp);
+ free(cp);
+ cp = shorten_unambiguous_ref(upstream->merge[0]->dst, 0);
+ strbuf_reset(buf);
+ strbuf_addstr(buf, cp);
+ free(cp);
+ return len;
+}
+
+/*
* This is like "get_sha1_basic()", except it allows "sha1 expressions",
* notably "xyz^" for "parent of xyz"
*/
diff --git a/t/t1506-rev-parse-upstream.sh b/t/t1506-rev-parse-upstream.sh
index a2c7f92..95c9b09 100755
--- a/t/t1506-rev-parse-upstream.sh
+++ b/t/t1506-rev-parse-upstream.sh
@@ -76,7 +76,7 @@ test_expect_success 'checkout -b new my-side@{u} forks from the same' '
)
'
-test_expect_failure 'merge my-side@{u} records the correct name' '
+test_expect_success 'merge my-side@{u} records the correct name' '
(
sq="'\''" &&
cd clone || exit
@@ -90,7 +90,7 @@ test_expect_failure 'merge my-side@{u} records the correct name' '
)
'
-test_expect_failure 'branch -d other@{u}' '
+test_expect_success 'branch -d other@{u}' '
git checkout -t -b other master &&
git branch -d @{u} &&
git for-each-ref refs/heads/master >actual &&
@@ -98,7 +98,7 @@ test_expect_failure 'branch -d other@{u}' '
test_cmp expect actual
'
-test_expect_failure 'checkout other@{u}' '
+test_expect_success 'checkout other@{u}' '
git branch -f master HEAD &&
git checkout -t -b another master &&
git checkout @{u} &&
--
1.6.6.513.g63f4c
^ permalink raw reply related
* [PATCH 1/2] t1506: more test for @{upstream} syntax
From: Junio C Hamano @ 2010-01-20 9:38 UTC (permalink / raw)
To: git; +Cc: Jeff King, Johannes Schindelin
In-Reply-To: <1263980322-4142-1-git-send-email-gitster@pobox.com>
This adds a few more tests that exercises @{upstream} syntax by commands
that operate differently when they are given branch name as opposed to a
refname (i.e. where "master" and "refs/heads/master" makes a difference).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t1506-rev-parse-upstream.sh | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/t/t1506-rev-parse-upstream.sh b/t/t1506-rev-parse-upstream.sh
index 5abdc13..a2c7f92 100755
--- a/t/t1506-rev-parse-upstream.sh
+++ b/t/t1506-rev-parse-upstream.sh
@@ -66,4 +66,45 @@ test_expect_success '@{u} without specifying branch fails on a detached HEAD' '
test_must_fail git rev-parse @{u}
'
+test_expect_success 'checkout -b new my-side@{u} forks from the same' '
+(
+ cd clone &&
+ git checkout -b new my-side@{u} &&
+ git rev-parse --symbolic-full-name my-side@{u} >expect &&
+ git rev-parse --symbolic-full-name new@{u} >actual &&
+ test_cmp expect actual
+)
+'
+
+test_expect_failure 'merge my-side@{u} records the correct name' '
+(
+ sq="'\''" &&
+ cd clone || exit
+ git checkout master || exit
+ git branch -D new ;# can fail but is ok
+ git branch -t new my-side@{u} &&
+ git merge -s ours new@{u} &&
+ git show -s --pretty=format:%s >actual &&
+ echo "Merge remote branch ${sq}origin/side${sq}" >expect &&
+ test_cmp expect actual
+)
+'
+
+test_expect_failure 'branch -d other@{u}' '
+ git checkout -t -b other master &&
+ git branch -d @{u} &&
+ git for-each-ref refs/heads/master >actual &&
+ >expect &&
+ test_cmp expect actual
+'
+
+test_expect_failure 'checkout other@{u}' '
+ git branch -f master HEAD &&
+ git checkout -t -b another master &&
+ git checkout @{u} &&
+ git symbolic-ref HEAD >actual &&
+ echo refs/heads/master >expect &&
+ test_cmp expect actual
+'
+
test_done
--
1.6.6.513.g63f4c
^ permalink raw reply related
* [PATCH 0/2] @{u} updates
From: Junio C Hamano @ 2010-01-20 9:38 UTC (permalink / raw)
To: git; +Cc: Jeff King, Johannes Schindelin
In-Reply-To: <7vwrzmqypn.fsf@alter.siamese.dyndns.org>
Earlier I wondered if the approach Dscho's patch takes to teach the new
@{upstream} syntax to substitute_branch_name() (hence dwim_ref()) without
teaching it to interpret_branch_name() (hence strbuf_branchname()) was a
bad idea. I thought about this a bit more; there are some downsides for
not doing so.
The first patch adds a handful of tests that show why strbuf_branchname()
callers may also want to learn about the new syntax. The second patch
moves the logic to interpret_branch_name() to make them happier.
The name of the key function was changed from tracked_suffix() to
upstream_mark(), not only because the syntax talks about @{upstream}, but
because the parsing needs to recognize the @{u}/@{upstream} mark at the
beginning of the given string (that is a suffix to some other string), and
strip it (the earlier code wanted @{u} to be at the very end but the
callers need to have it at the beginning).
Junio C Hamano (2):
t1506: more test for @{upstream} syntax
Teach @{upstream} syntax to strbuf_branchanme()
sha1_name.c | 116 ++++++++++++++++++++++++++---------------
t/t1506-rev-parse-upstream.sh | 41 ++++++++++++++
2 files changed, 115 insertions(+), 42 deletions(-)
^ permalink raw reply
* Re: git locate
From: Johannes Schindelin @ 2010-01-20 9:32 UTC (permalink / raw)
To: Jakub Narebski; +Cc: John Tapsell, Git List
In-Reply-To: <m3zl49bk0o.fsf@localhost.localdomain>
Hi,
On Tue, 19 Jan 2010, Jakub Narebski wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Wed, 20 Jan 2010, John Tapsell wrote:
> >
> > > Could we add a: git locate <filename> or git find <filename>
> >
> > How about "git ls-files \*<filename>"?
>
> Or "git ls-files '*filename'...
>
> ... but how to make an (git) alias for this?
Add something like this to your $HOME/.gitconfig:
[alias]
locate = !sh -c 'git ls-files "\\*$1"' -
Ciao,
Dscho
^ permalink raw reply
* Re: [RFC/PATCHv8 00/10] git notes
From: Junio C Hamano @ 2010-01-20 8:34 UTC (permalink / raw)
To: Johannes Sixt
Cc: Junio C Hamano, Alex Riesen, Johannes Sixt, Nanako Shiraishi,
Johan Herland, git, spearce
In-Reply-To: <4B56BC22.1040702@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
>> Subject: Fix "checkout A..." synonym for "checkout A...HEAD" on Windows
>> ...
>> Work this issue around by first calling check_ref_format(new.path) to see
>> if the string can possibly be a valid ref under "refs/heads/", before
>> asking resolve_ref().
>
> Your patch fixes the failure very nicely, thank you very much.
>
> BTW, calling 'git pack-refs --all' before 'git checkout master...'
> helps as well :-P
Thanks for a prompt response (given our timezone difference ;-)
I've been thinking about moving that check even further down, namely at
the beginning of resolve_ref(), as anything that is not valid cannot
possibly resolve correctly.
What do people think?
^ permalink raw reply
* Re: [RFC/PATCHv8 00/10] git notes
From: Johannes Sixt @ 2010-01-20 8:17 UTC (permalink / raw)
To: Junio C Hamano
Cc: Alex Riesen, Johannes Sixt, Nanako Shiraishi, Johan Herland, git,
spearce
In-Reply-To: <7vska15u92.fsf@alter.siamese.dyndns.org>
Junio C Hamano schrieb:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Alex Riesen <raa.lkml@gmail.com> writes:
>>> This breaks "checkout to merge base" on Windows and t2012 in particular.
>
> I think the attached patch would help. If this fix is Ok with Windows
> people (J6t CC'ed), I'd like to apply this to 'master' so that we can ship
> 1.7.0-rc0 without breakage.
>
> -- >8 --
> Subject: Fix "checkout A..." synonym for "checkout A...HEAD" on Windows
> ...
> Work this issue around by first calling check_ref_format(new.path) to see
> if the string can possibly be a valid ref under "refs/heads/", before
> asking resolve_ref().
Your patch fixes the failure very nicely, thank you very much.
BTW, calling 'git pack-refs --all' before 'git checkout master...'
helps as well :-P
-- Hannes
^ permalink raw reply
* Re: [question] retrieve some patches from another repository
From: Crane Cai @ 2010-01-20 8:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vljft5m7h.fsf@alter.siamese.dyndns.org>
Hi Junio,
Thank you. It's my pleasure to get git maintainer's response.
On Tue, Jan 19, 2010 at 10:23:14PM -0800, Junio C Hamano wrote:
> > * merge point will cause duplicated patch generated, for example repo B has x,
> > y, z, then accepted by repo A in merge point, and then merge back to repo B
> > (they are different with commit id), they will generate 2 twice.
>
> This is inevitable, if 'x' and (say) 'b' corresponds to each other but has
> textual changes due to different context.
So you mean git can not avoid generate 2 twice because they are different
commits. If I need this I will manually do it or add a new feature to let
format-patch can identify the relationship of the 2 repository, and then move
the 'since' point to avoid some point before merge.
Maybe it has value to do it. Many subsystem maintainers will easy to provide
patchset from any repository derived from linus to another repository which also
derived from linus. The patchset will let integration a little easy, you can use
'git bisect' to trace, git comments to understand the code. And all change list
is replayed, there almost no issue for integration.
>
>
> You are probably running "format-patch a.. -- path/to/file.c". Try giving
> it the --full-diff option as well. We've recently discussed to make it
> the default for format-patch but the discussion thread petered out and
> didn't reach conclusion.
Yes, you are right.
--
Best Regards,
- Crane
^ permalink raw reply
* Re: [PATCH v2] rev-parse --namespace
From: Johannes Sixt @ 2010-01-20 7:29 UTC (permalink / raw)
To: Ilari Liusvaara; +Cc: git
In-Reply-To: <1263798952-27624-1-git-send-email-ilari.liusvaara@elisanet.fi>
I've implemented --remotes=foo on top of your patch because I needed it,
and --namespace=remotes/foo was too much to type. Are you interested in
integrating this in your series in some way?
I only needed the --remotes=foo part; the --branches=foo is only
"because we can". Note that 'foo' is always a complete path component,
because it is the name of a remote (the trailing slash is implied), e.g.,
'--remotes=origin'.
--- 8< ---
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] revision options --remotes=prefix and --branches=prefix
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
builtin-rev-parse.c | 2 ++
revision.c | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 34af347..08b0555 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -42,6 +42,7 @@ static int is_rev_argument(const char *arg)
"--bisect",
"--dense",
"--branches",
+ "--branches=",
"--header",
"--max-age=",
"--max-count=",
@@ -52,6 +53,7 @@ static int is_rev_argument(const char *arg)
"--parents",
"--pretty",
"--remotes",
+ "--remotes=",
"--namespace=",
"--sparse",
"--tags",
diff --git a/revision.c b/revision.c
index ec63fa0..68e251b 100644
--- a/revision.c
+++ b/revision.c
@@ -714,6 +714,21 @@ static void handle_refs(struct rev_info *revs, unsigned flags,
for_each(handle_one_ref, &cb);
}
+static void handle_ref_subset(struct rev_info *revs, unsigned flags,
+ const char *prefix, const char *postfix)
+{
+ struct strbuf name = STRBUF_INIT;
+ struct all_refs_cb cb;
+
+ strbuf_addstr(&name, prefix);
+ strbuf_addstr(&name, postfix);
+ if (name.buf[name.len - 1] != '/')
+ strbuf_addch(&name, '/');
+ init_all_refs_cb(&cb, revs, flags);
+ for_each_ref_in(name.buf, handle_one_ref, &cb);
+ strbuf_release(&name);
+}
+
static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
@@ -1344,6 +1359,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
handle_refs(revs, flags, for_each_branch_ref);
continue;
}
+ if (!prefixcmp(arg, "--branches=")) {
+ handle_ref_subset(revs, flags, "refs/heads/", arg + 11);
+ continue;
+ }
if (!strcmp(arg, "--bisect")) {
handle_refs(revs, flags, for_each_bad_bisect_ref);
handle_refs(revs, flags ^ UNINTERESTING, for_each_good_bisect_ref);
@@ -1358,6 +1377,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
handle_refs(revs, flags, for_each_remote_ref);
continue;
}
+ if (!prefixcmp(arg, "--remotes=")) {
+ handle_ref_subset(revs, flags, "refs/remotes/", arg + 10);
+ continue;
+ }
if (!prefixcmp(arg, "--namespace=")) {
struct all_refs_cb cb;
--
1.6.6.1301.g354d
^ permalink raw reply related
* Re: [question] retrieve some patches from another repository
From: Junio C Hamano @ 2010-01-20 6:23 UTC (permalink / raw)
To: Crane Cai; +Cc: git
In-Reply-To: <20100120054614.GA1965@crane-desktop>
Crane Cai <crane.cai@amd.com> writes:
> * merge point will cause duplicated patch generated, for example repo B has x,
> y, z, then accepted by repo A in merge point, and then merge back to repo B
> (they are different with commit id), they will generate 2 twice.
This is inevitable, if 'x' and (say) 'b' corresponds to each other but has
textual changes due to different context.
> * some commits do not only change the driver source code, and they change some
> other files also. Unfortunately git format-patch cut them. It cause compile
> error.
You are probably running "format-patch a.. -- path/to/file.c". Try giving
it the --full-diff option as well. We've recently discussed to make it
the default for format-patch but the discussion thread petered out and
didn't reach conclusion.
^ permalink raw reply
* [question] retrieve some patches from another repository
From: Crane Cai @ 2010-01-20 5:46 UTC (permalink / raw)
To: git
Hi,
Sorry to disturb you. I know this mail list is mainly for git development. Till
now I have not found some normal user mail list, at last I choose it to ask a
question.
My target is:
repository A - linux upstream:
a->b->c->d->[merge from repository B]->e->f
repository B - a maintainer's tree:
x->y->z->[merge from repository A]->...
I want to retrieve the patches for one driver and its related
changes from commit "a" till maintainer's master.
So I do as this:
* git checkout repo B's master
* because maintainer's tree is derived from upstream point "a" will be included,
use git format-patch repo a source-code-name
There are 2 issues in it:
* merge point will cause duplicated patch generated, for example repo B has x,
y, z, then accepted by repo A in merge point, and then merge back to repo B
(they are different with commit id), they will generate 2 twice.
* some commits do not only change the driver source code, and they change some
other files also. Unfortunately git format-patch cut them. It cause compile
error.
My question:
Does some one know git have the ability to do it or do I need to do it
manually?
--
Best Regards,
- Crane
^ permalink raw reply
* git notes: notes
From: Joey Hess @ 2010-01-20 5:03 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 564 bytes --]
Just a quick note that the new notes feature can break things that parse
git log. For example a parser that assumes it can split the log on blank
lines to separate the header and commit message, can easily become
confused by the new blank line before "Notes:".
Might be worth documenting in release notes, maybe too late now though.
But really, it's all good, notes are a great feature.
PS, Has anyone thought about using notes to warn bisect away from
commits that are known to be unbuildable or otherwise cause bisection
trouble?
--
see shy jo
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [RFC/PATCHv8 00/10] git notes
From: Junio C Hamano @ 2010-01-20 3:29 UTC (permalink / raw)
To: Alex Riesen; +Cc: Johannes Sixt, Nanako Shiraishi, Johan Herland, git, spearce
In-Reply-To: <7vk4ve9dad.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Alex Riesen <raa.lkml@gmail.com> writes:
>
>> On Fri, Nov 20, 2009 at 11:46, Junio C Hamano <gitster@pobox.com> wrote:
>>> @@ -716,7 +719,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
>>> if (!strcmp(arg, "-"))
>>> arg = "@{-1}";
>>>
>>> - if (get_sha1(arg, rev)) {
>>> + if (get_sha1_mb(arg, rev)) {
>>> if (has_dash_dash) /* case (1) */
>>> die("invalid reference: %s", arg);
>>> if (!patch_mode &&
>>
>> This is a bit of a problem on Windows, as the arg (eventually containing
>> something like "master..."), will be passed to resolve_ref below.
>
> I don't see "resolve_ref below"; do you mean this part?
>
> /* we can't end up being in (2) anymore, eat the argument */
> argv++;
> argc--;
>
> new.name = arg;
> if ((new.commit = lookup_commit_reference_gently(rev, 1))) {
> setup_branch_path(&new);
> if (resolve_ref(new.path, rev, 1, NULL))
> new.commit = lookup_commit_reference(rev);
> else
> new.path = NULL;
> parse_commit(new.commit);
> source_tree = new.commit->tree;
> } else
> source_tree = parse_tree_indirect(rev);
>
> It is primarily to tell "git checkout master" and "git checkout master^0"
> apart (the latter must detach HEAD). IOW, it is testing if you gave the
> "name" of the branch, or something that yields the commit object name that
> happens to be at the tip of the branch. So the call to resolve_ref() is
> very relevant.
>
>> Now, Windows,
>> being the piece of shit it is, will lie and tell that a file
>> "refs/heads/master..."
>> exists and be same as "refs/heads/master".
>
> Meh; then windows users cannot use "git checkout A..." syntax (they can
> still use "git checkout A...HEAD", I presume).
>
> This is not a problem specific to three-dots, but if you give the function
> "refs/heads/master.." it would also get "exists" back, no? You could
> teach resolve_ref() about windows (namely, the filesystem may lie about
> anything that ends with a series of dots).
>
>> This breaks "checkout to merge base" on Windows and t2012 in particular.
I think the attached patch would help. If this fix is Ok with Windows
people (J6t CC'ed), I'd like to apply this to 'master' so that we can ship
1.7.0-rc0 without breakage.
Thanks.
-- >8 --
Subject: Fix "checkout A..." synonym for "checkout A...HEAD" on Windows
When switching to a different commit, we first see the named rev exists
as a commit using lookup_commit_reference_gently(), and set new.path to
a string "refs/heads/" followed by the name the user gave us (but after
taking into special short-hands like @{-1} == "previous branch" and
"@{upstream}" == "the branch we merge with" into account). If the
resulting string names an existsing ref, then we are switching to that
branch (and will be building new commits on top of it); otherwise we are
detaching HEAD at that commit.
When the "master..." syntax is used as a short-hand for "master...HEAD",
we do want to detach HEAD at the merge base. However, on Windows, when
asked if ".git/refs/heads/master..." exists, the filesystem happily says
"it does" when ".git/refs/heads/master" exists.
Work this issue around by first calling check_ref_format(new.path) to see
if the string can possibly be a valid ref under "refs/heads/", before
asking resolve_ref().
We used to run another lookup_commit_reference(rev) even though we know it
succeeded and we have a good commit in new.commit already; this has been
with us from 782c2d6 (Build in checkout, 2008-02-07), the first version we
had "git checkout" implemented in C. Drop it.
Noticed by Alex Riesen.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-checkout.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin-checkout.c b/builtin-checkout.c
index fe7c858..ad3c01f 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -745,8 +745,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
new.name = arg;
if ((new.commit = lookup_commit_reference_gently(rev, 1))) {
setup_branch_path(&new);
- if (resolve_ref(new.path, rev, 1, NULL))
- new.commit = lookup_commit_reference(rev);
+
+ if ((check_ref_format(new.path) == CHECK_REF_FORMAT_OK) &&
+ resolve_ref(new.path, rev, 1, NULL))
+ ;
else
new.path = NULL;
parse_commit(new.commit);
^ permalink raw reply related
* [OT] git fsck uncovers hardware/kernel problem?
From: John Koleszar @ 2010-01-20 2:54 UTC (permalink / raw)
To: git
Hi all,
I don't think that this is a git issue, but I've only reproduced it so
far using git and I know there are people here that can point me in the
right direction, so please forgive the off-topic post.
I was repairing a repo today that I thought was corrupt, and when I
finished, it fsck'd ok but then ran into another corruption error when
gc'ing it. I realized these errors were intermittent. I ran into this
situation once before (same machine) and was time-pressed, so I rebooted
and the problem went away. This time I have a little free time to
investigate.
It looks like somehow my buffer cache is getting inconsistent with
what's actually on the disk. I'm looking for input as to whether this is
a kernel problem, bad memory, dieing hard disk, etc. This machine has
been stable, and I've had no unexplained crashes or other noticeable
data corruption. No errors from the kernel, no SMART errors. Only
notable thing about the repos I was working on when this happened is
that they were large -- exceeding the size of physical RAM. Lots of
binary objects. The one I'm looking at now is about 3.8GB packed.
Please see below -- any pointers would be appreciated, including to a
more appropriate list.
$ git fsck --full
error: inflate: data stream error (incorrect data check)
error: corrupt loose object '060a8f0255a4a0b76197056e959bb0ce37b90dae'
fatal: object 060a8f0255a4a0b76197056e959bb0ce37b90dae is corrupted
$ echo 3 | sudo tee /proc/sys/vm/drop_caches
Password:
3
$ git fsck --fullerror: inflate: data stream error (incorrect data check)
error: corrupt loose object '0905cc800a08a24c8d83132c4d346d8b47403a73'
fatal: object 0905cc800a08a24c8d83132c4d346d8b47403a73 is corrupted
# Note this is a different object
$ git fsck --fullerror: inflate: data stream error (incorrect data check)
error: corrupt loose object '0905cc800a08a24c8d83132c4d346d8b47403a73'
fatal: object 0905cc800a08a24c8d83132c4d346d8b47403a73 is corrupted
# but running again gives a consistent error until dropping caches again
$ echo 3 | sudo tee /proc/sys/vm/drop_caches
3
$ git fsck --full
error: inflate: data stream error (incorrect data check)
error: corrupt loose object '3e9a88bfea886dd4bd4af69870e33f115bc80985'
fatal: object 3e9a88bfea886dd4bd4af69870e33f115bc80985 is corrupted
# fsck progresses much farther this time.
$ sha1sum objects/3e/9a88bfea886dd4bd4af69870e33f115bc80985
acffc0e434297e5115b2491101d0a0260a20a1aa
objects/3e/9a88bfea886dd4bd4af69870e33f115bc80985
$ echo 3 | sudo tee /proc/sys/vm/drop_caches
3
$ sha1sum objects/3e/9a88bfea886dd4bd4af69870e33f115bc80985
83a1291ecb9e2fd9ded509aefba2a3c474d259c2
objects/3e/9a88bfea886dd4bd4af69870e33f115bc80985
# sha1sum is different, so this issue isn't limited to git
$ git cat-file blob 3e9a88bfea886dd4bd4af69870e33f115bc80985>/dev/null
# git's integrity checks pass on this file now.
$ uname -a
Linux cp-jk-linux 2.6.30-gentoo-r5 #3 SMP Wed Nov 4 12:53:38 EST 2009
x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
---
Thanks,
John
^ permalink raw reply
* Re: git locate
From: Jakub Narebski @ 2010-01-20 2:14 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: John Tapsell, Git List
In-Reply-To: <alpine.DEB.1.00.1001200224270.4985@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Wed, 20 Jan 2010, John Tapsell wrote:
>
> > Could we add a: git locate <filename> or git find <filename>
>
> How about "git ls-files \*<filename>"?
Or "git ls-files '*filename'...
... but how to make an (git) alias for this?
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] git status: do not require write permission
From: Junio C Hamano @ 2010-01-20 1:38 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jeff King, git
In-Reply-To: <alpine.DEB.1.00.1001200220570.4985@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> BTW you can tell me directly that you do not want any patches from me
> anymore, rather than dancing around the issue. I kind of figured that
> already anyway.
Oh, what gave you that impression?
I don't like getting patches that go only halfway, making things work
better for some people but at the same time breaking things for others,
without following thorough for a long time, and that is regardless of
where the patches came from.
They linger on 'pu' forever and forces me to choose one of the three
outcome:
(1) discard it, even if it is promising;
(2) make myself a janitor and filling the gap;
(3) keep it on 'pu' even longer, while occassionally suffering merge
conflicts with topics that touch the same textual area from more
responsive people.
I try to avoid (1) but I obviously don't want to do (2), especially when
I know the topic originally came from a capable hand.
If anything, the more promising the patch series that the original author
didn't follow through, the worse it will make me feel to discard it. If
you feel that I get grumpy about many of your patches not followed through
than about other people's patches, perhaps it is a sign that I consider
that the aim (not necessarily the execution) of your topics are better
than the topics from others.
So don't take it personally.
^ permalink raw reply
* Re: git locate
From: Johannes Schindelin @ 2010-01-20 1:24 UTC (permalink / raw)
To: John Tapsell; +Cc: Git List
In-Reply-To: <43d8ce651001191717l58d10919j691f4e5b056fe9b5@mail.gmail.com>
Hi,
On Wed, 20 Jan 2010, John Tapsell wrote:
> Could we add a: git locate <filename> or git find <filename>
How about "git ls-files \*<filename>"?
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] git status: do not require write permission
From: Johannes Schindelin @ 2010-01-20 1:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, git
In-Reply-To: <7vhbqh7gpa.fsf@alter.siamese.dyndns.org>
Hi,
On Tue, 19 Jan 2010, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > On Wed, Jan 20, 2010 at 01:06:17AM +0100, Johannes Schindelin wrote:
> >
> >> Today, git status played violin on my nerves for the very last time.
> >> There is no good reason, really none, for git status to require
> >> write permissions. If the index is not up-to-date, so be it, I
> >> cannot commit anyway.
> >
> > I agree it is annoying, but this patch does not apply (and is no longer
> > needed) on master since the status-is-no-longer-commit-dry-run series
> > has been merged.
> >
> > I don't know if it is worth putting your fix onto maint.
>
> I think the patch itself makes sense, even though the log message seems to
> be with more noise and frustrationthan with useful information.
If you think so.
> And "for the very last time" is probably a good characterization, as
> status will no longer be "commit --dry-run" in the coming release ;-)
This comment was because I was fully prepared to do the same as with so
many patches: keep them in my personal repository until time finally tells
that that patch should go into 'next'.
And as you realized, I managed to forget a commit --amend, which would
have replaced 1 with !is_status.
BTW you can tell me directly that you do not want any patches from me
anymore, rather than dancing around the issue. I kind of figured that
already anyway.
Ciao,
Dscho
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox