* Re: [PATCH resend] Do not create commits whose message contains NUL
From: Jeff King @ 2011-12-14 7:17 UTC (permalink / raw)
To: Miles Bader; +Cc: Nguyễn Thái Ngọc Duy, git
In-Reply-To: <buomxavwwtq.fsf@dhlpc061.dev.necel.com>
On Wed, Dec 14, 2011 at 02:23:29PM +0900, Miles Bader wrote:
> Jeff King <peff@peff.net> writes:
> > But maybe it would be nicer to say something like:
> >
> > error: your commit message contains NUL characters.
> > hint: This is often caused by using multibyte encodings such as
> > hint: UTF-16. Please check your editor settings.
>
> I think the error message with the hint is much better for users, but
> isn't the term "multibyte" a little misleading here? It seems like
> it's really _wide_ encodings that are generally the culprit.
Yeah, wide is probably a better term. I'm not sure it is rigorously
defined anywhere, but in general I think it refers to the set of
encodings that do not care about the embedding of 8-bit ascii bytes as
subsets.
-Peff
^ permalink raw reply
* tr/pty-all (Re: What's cooking in git.git (Dec 2011, #04; Tue, 13))
From: Jonathan Nieder @ 2011-12-14 7:09 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Thomas Rast, Jeff King,
Nguyễn Thái Ngọc Duy
In-Reply-To: <7vobvcrlve.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> * tr/pty-all (2011-12-12) 3 commits
> - t/lib-terminal: test test-terminal's sanity
> - test-terminal: set output terminals to raw mode
> - test-terminal: give the child an empty stdin TTY
>
> Will merge to 'next' after taking another look.
The middle commit looks good. The bottom commit could be improved as
discussed at [1], but I guess that can happen in-tree.
However, the top commit ("test test-terminal's sanity") still does not
seem right to me.
It makes the same test run three times. Probably I should send an
alternate patch to get that sanity-check to run once, but I am also
not convinced the sanity-check is needed at all --- wouldn't any test
that is relying on output from test_terminal act as a sanity check for
it already?
As an aside, I also still believe that running "git shortlog" without
explicitly passing "HEAD" when testing how it reacts to [core] pager
configuration was a bug and a distraction, hence the patch at [2]. Am
I the only one? I also find Jeff's patch [3] appealing.
Thanks,
Jonathan
[1] http://thread.gmane.org/gmane.comp.version-control.git/186923/focus=186944
[2] http://article.gmane.org/gmane.comp.version-control.git/186932
[3] http://article.gmane.org/gmane.comp.version-control.git/186936
^ permalink raw reply
* Re: [PATCH resend] Do not create commits whose message contains NUL
From: Miles Bader @ 2011-12-14 5:23 UTC (permalink / raw)
To: Jeff King; +Cc: Nguyễn Thái Ngọc Duy, git
In-Reply-To: <20111213175932.GA1663@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> But maybe it would be nicer to say something like:
>
> error: your commit message contains NUL characters.
> hint: This is often caused by using multibyte encodings such as
> hint: UTF-16. Please check your editor settings.
I think the error message with the hint is much better for users, but
isn't the term "multibyte" a little misleading here? It seems like
it's really _wide_ encodings that are generally the culprit.
[UTF-16 of course is particularly nasty in that it uses both units which
are wider than a byte ("wide"), _and_ multiple units per code-point....]
Thanks,
-Miles
--
Quack, n. A murderer without a license.
^ permalink raw reply
* Re: [PATCH 0/3] use constants for sideband communication channels
From: Junio C Hamano @ 2011-12-14 4:56 UTC (permalink / raw)
To: iheffner; +Cc: git, Jeff King, Dave Olszewski
In-Reply-To: <1323800931-37123-1-git-send-email-iheffner@gmail.com>
iheffner@gmail.com writes:
> In order to make more clear how the different channels in sidechannel.c
> are to be used, I'm proposing some macros/constants which can be used in
> place of the "magic numbers" that mean little or nothing to someone not
> familiar with the protocol.
I am not fundamentally opposed to the stated goal, but the posted patches
make the resulting code way too wide for comfortable reading. Can we use a
bit shorter symbols?
Perhaps a good way to start would be to first refrain from using these
symbols, but give a prominent comment near the API functions that are used
to send and receive sideband data to explain which band is used for what
purpose, which should be enough for people who are writing the code to
link with these functions.
^ permalink raw reply
* Re: Tracking file metadata in git -- fix metastore or enhance git?
From: johnnyutahh @ 2011-12-14 4:54 UTC (permalink / raw)
To: git
In-Reply-To: <20110418004550.GA2529@elie>
Following up on
http://git.661346.n2.nabble.com/Tracking-file-metadata-in-git-fix-metastore-or-enhance-git-td6251248.html
this discussion re: git file-metadata-management , posted this:
http://superuser.com/questions/367729/how-to-reuse-extend-etckeepers-metadata-engine-for-git-control-of-non-etc-file
Any further movement on this topic?
Jonathan Nieder-2 wrote
>
> Hi again,
>
> Not sure if my thoughts will be useful here since you dropped me from
> the cc list. But anyway:
>
> Richard Hartmann wrote:
>
>> here are the three options:
>>
>> 1) fix metastore
>> 2) default to gitperms
>> 3) extend git
>>
>> I still think 3) would be best, but someone would need to step up to
>> do this. Is anyone up for this task? If not, we will have to resort to
>> 1) or 2)
>
> The usual practice in git development is
>
> (1) people make scripts wrapping plumbing commands (see git(1)) that
> work well for themselves
> (2) they tell the git list about it and publish it
> (3) an idea emerges that this is suitable for inclusion, and it
> gets included
>
> In particular, git's design is not so monolithic --- "extend git" can
> mean "add a script" or "add a builtin" so it is not so involved as you
> seem to think. See also contrib/README for a place to stop on the
> way.
>
> Anyway, if you want something the just works, my suggestion is (4) use
> the hook scripts from etckeeper. Last time I looked into this they
> worked better than metastore.
>
> Hope that helps.
> Jonathan
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@.kernel
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
View this message in context: http://git.661346.n2.nabble.com/Tracking-file-metadata-in-git-fix-metastore-or-enhance-git-tp6251248p7092383.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply
* Re: [PATCH v2 28/51] refs.c: rename ref_array -> ref_dir
From: Jeff King @ 2011-12-14 2:33 UTC (permalink / raw)
To: Junio C Hamano
Cc: Michael Haggerty, git, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips
In-Reply-To: <7vborct37c.fsf@alter.siamese.dyndns.org>
On Tue, Dec 13, 2011 at 04:19:19PM -0800, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> >> Namely, we should figure out what code wants to set extra refs and or
> >> wants to include extra refs in its iteration over references. The
> >> setters don't have to be changed, but the readers should be.
> >
> > You read me correctly. That is exactly what I meant by "extra ref API" in
> > my earlier response.
>
> Actually, I do not think it even needs to be the "extra *REF* API". The
> only thing that matters is that these commits are considered to be extra
> anchor point in the history, in addition to the usual rule of considering
> that everything reachable from our refs is complete. The data structure to
> hold them does not even have to be a "struct ref". Just an array of object
> names (or "struct object *") should suffice.
Since my cff38a5 (receive-pack: eliminate duplicate .have refs,
2011-05-19), receive-pack simply has a packed array of binary sha1s (in
a "struct sha1_array" object). That might be the simplest thing.
-Peff
^ permalink raw reply
* What's cooking in git.git (Dec 2011, #04; Tue, 13)
From: Junio C Hamano @ 2011-12-14 1:19 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed with '-' are
only in 'pu' (proposed updates) while commits prefixed with '+' are in
'next'.
Here are the repositories that have my integration branches:
With maint, master, next, pu, todo:
git://git.kernel.org/pub/scm/git/git.git
git://repo.or.cz/alt-git.git
https://code.google.com/p/git-core/
https://github.com/git/git
With only maint and master:
git://git.sourceforge.jp/gitroot/git-core/git.git
git://git-core.git.sourceforge.net/gitroot/git-core/git-core
With all the topics and integration branches:
https://github.com/gitster/git
The preformatted documentation in HTML and man format are found in:
git://git.kernel.org/pub/scm/git/git-{htmldocs,manpages}.git/
git://repo.or.cz/git-{htmldocs,manpages}.git/
https://code.google.com/p/git-{htmldocs,manpages}.git/
https://github.com/gitster/git-{htmldocs,manpages}.git/
--------------------------------------------------
[New Topics]
* jk/maint-fetch-status-table (2011-12-09) 1 commit
(merged to 'next' on 2011-12-09 at 159415e)
+ fetch: create status table using strbuf
Will merge to 'master'.
* ci/stripspace-docs (2011-12-12) 1 commit
(merged to 'next' on 2011-12-13 at 35b2cdf)
+ Update documentation for stripspace
* jk/maint-mv (2011-12-12) 5 commits
(merged to 'next' on 2011-12-13 at 58caedb)
+ mv: be quiet about overwriting
+ mv: improve overwrite warning
+ mv: make non-directory destination error more clear
+ mv: honor --verbose flag
+ docs: mention "-k" for both forms of "git mv"
* jk/maint-snprintf-va-copy (2011-12-12) 1 commit
(merged to 'next' on 2011-12-13 at d37a7e1)
+ compat/snprintf: don't look at va_list twice
* jn/maint-sequencer-fixes (2011-12-12) 7 commits
(merged to 'next' on 2011-12-13 at 5b3950c)
+ revert: stop creating and removing sequencer-old directory
+ Revert "reset: Make reset remove the sequencer state"
+ revert: do not remove state until sequence is finished
+ revert: allow single-pick in the middle of cherry-pick sequence
+ revert: pass around rev-list args in already-parsed form
+ revert: allow cherry-pick --continue to commit before resuming
+ revert: give --continue handling its own function
* mh/ref-api (2011-12-12) 51 commits
- repack_without_ref(): call clear_packed_ref_cache()
- read_packed_refs(): keep track of the directory being worked in
- is_refname_available(): query only possibly-conflicting references
- refs: read loose references lazily
- read_loose_refs(): take a (ref_entry *) as argument
- struct ref_dir: store a reference to the enclosing ref_cache
- sort_ref_dir(): take (ref_entry *) instead of (ref_dir *)
- do_for_each_ref_in_dir*(): take (ref_entry *) instead of (ref_dir *)
- add_entry(): take (ref_entry *) instead of (ref_dir *)
- search_ref_dir(): take (ref_entry *) instead of (ref_dir *)
- find_containing_direntry(): use (ref_entry *) instead of (ref_dir *)
- add_ref(): take (ref_entry *) instead of (ref_dir *)
- read_packed_refs(): take (ref_entry *) instead of (ref_dir *)
- find_ref(): take (ref_entry *) instead of (ref_dir *)
- is_refname_available(): take (ref_entry *) instead of (ref_dir *)
- get_loose_refs(): return (ref_entry *) instead of (ref_dir *)
- get_packed_refs(): return (ref_entry *) instead of (ref_dir *)
- refs: wrap top-level ref_dirs in ref_entries
- get_ref_dir(): keep track of the current ref_dir
- do_for_each_ref(): only iterate over the subtree that was requested
- refs: sort ref_dirs lazily
- sort_ref_dir(): do not sort if already sorted
- refs: store references hierarchically
- refs.c: rename ref_array -> ref_dir
- struct ref_entry: nest the value part in a union
- check_refname_component(): return 0 for zero-length components
- free_ref_entry(): new function
- refs.c: reorder definitions more logically
- is_refname_available(): reimplement using do_for_each_ref_in_array()
- names_conflict(): simplify implementation
- names_conflict(): new function, extracted from is_refname_available()
- repack_without_ref(): reimplement using do_for_each_ref_in_array()
- do_for_each_ref_in_arrays(): new function
- do_for_each_ref_in_array(): new function
- do_for_each_ref(): correctly terminate while processesing extra_refs
- add_ref(): take a (struct ref_entry *) parameter
- create_ref_entry(): extract function from add_ref()
- repack_without_ref(): remove temporary
- resolve_gitlink_ref_recursive(): change to work with struct ref_cache
- Pass a (ref_cache *) to the resolve_gitlink_*() helper functions
- resolve_gitlink_ref(): improve docstring
- get_ref_dir(): change signature
- refs: change signatures of get_packed_refs() and get_loose_refs()
- is_dup_ref(): extract function from sort_ref_array()
- add_ref(): add docstring
- parse_ref_line(): add docstring
- is_refname_available(): remove the "quiet" argument
- clear_ref_array(): rename from free_ref_array()
- refs: rename parameters result -> sha1
- refs: rename "refname" variables
- struct ref_entry: document name member
* nd/resolve-ref (2011-12-13) 3 commits
(merged to 'next' on 2011-12-13 at c7002e9)
+ Rename resolve_ref() to resolve_ref_unsafe()
+ Convert resolve_ref+xstrdup to new resolve_refdup function
+ revert: convert resolve_ref() to read_ref_full()
* tr/grep-threading (2011-12-12) 3 commits
- grep: disable threading in non-worktree case
- grep: enable threading with -p and -W using lazy attribute lookup
- grep: load funcname patterns for -W
Will merge to 'next' after taking another look.
* tr/pty-all (2011-12-12) 3 commits
- t/lib-terminal: test test-terminal's sanity
- test-terminal: set output terminals to raw mode
- test-terminal: give the child an empty stdin TTY
Will merge to 'next' after taking another look.
* jc/push-ignore-stale (2011-12-13) 2 commits
- push: --ignore-stale option
- set_ref_status_for_push(): use transport-flags abstraction
* jk/fetch-no-tail-match-refs (2011-12-13) 4 commits
(merged to 'next' on 2011-12-13 at 805c018)
+ connect.c: drop path_match function
+ fetch-pack: match refs exactly
+ t5500: give fully-qualified refs to fetch-pack
+ drop "match" parameter from get_remote_heads
* jk/maint-push-over-dav (2011-12-13) 2 commits
(merged to 'next' on 2011-12-13 at 45e376c)
+ http-push: enable "proactive auth"
+ t5540: test DAV push with authentication
--------------------------------------------------
[Cooking]
* rr/revert-cherry-pick (2011-12-09) 9 commits
. revert: simplify communicating command-line arguments
. revert: report fine-grained error messages from insn parser
. revert: allow mixed pick and revert instructions
. t3510 (cherry-pick-sequencer): remove malformed sheet 2
. t3510 (cherry-pick-sequencer): use exit status
. revert: simplify getting commit subject in format_todo()
. revert: tolerate extra spaces, tabs in insn sheet
. revert: make commit subjects in insn sheet optional
. revert: free msg in format_todo()
Ejected for now, to give higher priority to jn/maint-sequencer-fixes
topic.
* ew/keepalive (2011-12-05) 1 commit
(merged to 'next' on 2011-12-13 at 1b5d5c4)
+ enable SO_KEEPALIVE for connected TCP sockets
* jc/checkout-m-twoway (2011-12-11) 2 commits
(merged to 'next' on 2011-12-11 at b61057f)
+ Test 'checkout -m -- path'
(merged to 'next' on 2011-12-09 at c946009)
+ checkout -m: no need to insist on having all 3 stages
* tr/cache-tree (2011-12-06) 5 commits
(merged to 'next' on 2011-12-13 at e0da64d)
+ reset: update cache-tree data when appropriate
+ commit: write cache-tree data when writing index anyway
+ Refactor cache_tree_update idiom from commit
+ Test the current state of the cache-tree optimization
+ Add test-scrap-cache-tree
* tr/userdiff-c-returns-pointer (2011-12-06) 1 commit
(merged to 'next' on 2011-12-09 at 0b6a092)
+ userdiff: allow * between cpp funcname words
Will merge to 'master'.
* jc/commit-amend-no-edit (2011-12-08) 5 commits
(merged to 'next' on 2011-12-09 at b9cfa4e)
+ test: commit --amend should honor --no-edit
+ commit: honour --no-edit
+ t7501 (commit): modernize style
+ test: remove a porcelain test that hard-codes commit names
+ test: add missing "&&" after echo command
* jl/submodule-status-failure-report (2011-12-08) 1 commit
(merged to 'next' on 2011-12-09 at 53eb3b3)
+ diff/status: print submodule path when looking for changes fails
Will merge to 'master'.
* ks/tag-cleanup (2011-12-09) 1 commit
(merged to 'next' on 2011-12-09 at cbea045)
+ git-tag: introduce --cleanup option
Will merge to 'master'.
* rr/test-chaining (2011-12-11) 7 commits
(merged to 'next' on 2011-12-13 at b08445e)
+ t3401: use test_commit in setup
+ t3401: modernize style
+ t3040 (subprojects-basic): fix '&&' chaining, modernize style
+ t1510 (worktree): fix '&&' chaining
+ t3030 (merge-recursive): use test_expect_code
+ test: fix '&&' chaining
+ t3200 (branch): fix '&&' chaining
* bc/maint-apply-check-no-patch (2011-12-05) 2 commits
(merged to 'next' on 2011-12-09 at fc780cd)
+ builtin/apply.c: report error on failure to recognize input
+ t/t4131-apply-fake-ancestor.sh: fix broken test
Will merge to 'master'.
* aw/rebase-i-stop-on-failure-to-amend (2011-11-30) 1 commit
(merged to 'next' on 2011-12-09 at a117e83)
+ rebase -i: interrupt rebase when "commit --amend" failed during "reword"
* jc/split-blob (2011-12-01) 6 commits
. WIP (streaming chunked)
- chunked-object: fallback checkout codepaths
- bulk-checkin: support chunked-object encoding
- bulk-checkin: allow the same data to be multiply hashed
- new representation types in the packstream
- varint-in-pack: refactor varint encoding/decoding
(this branch uses jc/stream-to-pack.)
Not ready. At least pack-objects and fsck need to learn the new encoding
for the series to be usable locally, and then index-pack/unpack-objects
needs to learn it to be used remotely.
* jh/fast-import-notes (2011-11-28) 3 commits
(merged to 'next' on 2011-12-09 at 2b01132)
+ fast-import: Fix incorrect fanout level when modifying existing notes refs
+ t9301: Add 2nd testcase exposing bugs in fast-import's notes fanout handling
+ t9301: Fix testcase covering up a bug in fast-import's notes fanout handling
Will merge to 'master'.
* tj/maint-imap-send-remove-unused (2011-11-23) 2 commits
(merged to 'next' on 2011-12-09 at 877cc11)
+ Merge branch 'maint' into tj/imap-send-remove-unused
+ imap-send: Remove unused 'use_namespace' variable
Will merge to 'master'.
* cn/maint-lf-to-crlf-filter (2011-11-28) 1 commit
(merged to 'next' on 2011-12-09 at c374d14)
+ convert: track state in LF-to-CRLF filter
Will merge to 'master'.
* jn/branch-move-to-self (2011-11-28) 2 commits
(merged to 'next' on 2011-12-09 at 7d27260)
+ Allow checkout -B <current-branch> to update the current branch
+ branch: allow a no-op "branch -M <current-branch> HEAD"
Will merge to 'master'.
* jk/credentials (2011-12-12) 24 commits
- contrib: add credential helper for OS X Keychain
- Makefile: OS X has /dev/tty
- Makefile: linux has /dev/tty
- credential: use git_prompt instead of git_getpass
- prompt: use git_terminal_prompt
- add generic terminal prompt function
- refactor git_getpass into generic prompt function
- move git_getpass to its own source file
- imap-send: don't check return value of git_getpass
- imap-send: avoid buffer overflow
(merged to 'next' on 2011-12-12 at 7a6d658)
+ t: add test harness for external credential helpers
+ credentials: add "store" helper
+ strbuf: add strbuf_add*_urlencode
+ Makefile: unix sockets may not available on some platforms
+ credentials: add "cache" helper
+ docs: end-user documentation for the credential subsystem
+ credential: make relevance of http path configurable
+ credential: add credential.*.username
+ credential: apply helper config
+ http: use credential API to get passwords
+ credential: add function for parsing url components
+ introduce credentials API
+ t5550: fix typo
+ test-lib: add test_config_global variant
Looking good. Probably split the later part into its own topic and
merge the parts already in 'next' to 'master' soonish.
* nd/ignore-might-be-precious (2011-11-28) 2 commits
(merged to 'next' on 2011-12-09 at 1a94553)
+ checkout,merge: disallow overwriting ignored files with --no-overwrite-ignore
+ Merge branch 'nd/maint-ignore-exclude' into nd/ignore-might-be-precious
Will merge to 'master'.
* jk/upload-archive-use-start-command (2011-11-21) 1 commit
(merged to 'next' on 2011-12-09 at 88cb83a)
+ upload-archive: use start_command instead of fork
* jk/maint-1.6.2-upload-archive (2011-11-21) 1 commit
+ archive: don't let remote clients get unreachable commits
(this branch is used by jk/maint-upload-archive.)
* jk/maint-upload-archive (2011-11-21) 1 commit
(merged to 'next' on 2011-12-09 at 03deb16)
+ Merge branch 'jk/maint-1.6.2-upload-archive' into jk/maint-upload-archive
(this branch uses jk/maint-1.6.2-upload-archive.)
Will merge to 'master'.
* ab/enable-i18n (2011-12-05) 1 commit
(merged to 'next' on 2011-12-13 at 65af8cd)
+ i18n: add infrastructure for translating Git with gettext
* jc/signed-commit (2011-11-29) 5 commits
- gpg-interface: allow use of a custom GPG binary
- pretty: %G[?GS] placeholders
- test "commit -S" and "log --show-signature"
- log: --show-signature
- commit: teach --gpg-sign option
Not exactly urgent.
* jc/stream-to-pack (2011-12-01) 5 commits
(merged to 'next' on 2011-12-09 at d0fd605)
+ bulk-checkin: replace fast-import based implementation
+ csum-file: introduce sha1file_checkpoint
+ finish_tmp_packfile(): a helper function
+ create_tmp_packfile(): a helper function
+ write_pack_header(): a helper function
(this branch is used by jc/split-blob.)
Teaches "git add" to send large-ish blob data straight to a packfile.
This is a continuation to the "large file support" topic. The codepath to
move data from worktree to repository is made aware of streaming, just
like the checkout codepath that goes the other way, which was done in the
previous "large file support" topic in the 1.7.7 cycle.
* jn/gitweb-side-by-side-diff (2011-10-31) 8 commits
(merged to 'next' on 2011-12-09 at 7662e58)
+ gitweb: Add navigation to select side-by-side diff
+ gitweb: Use href(-replay=>1,...) for formats links in "commitdiff"
+ t9500: Add basic sanity tests for side-by-side diff in gitweb
+ t9500: Add test for handling incomplete lines in diff by gitweb
+ gitweb: Give side-by-side diff extra CSS styling
+ gitweb: Add a feature to show side-by-side diff
+ gitweb: Extract formatting of diff chunk header
+ gitweb: Refactor diff body line classification
Replaces a series from Kato Kazuyoshi on the same topic.
Will merge to 'master'.
^ permalink raw reply
* Re: [PATCH] stash: Fix multiple error messages on create if no HEAD
From: Junio C Hamano @ 2011-12-14 1:16 UTC (permalink / raw)
To: Sebastian Morr; +Cc: git
In-Reply-To: <20111214001432.GA2959@thinkpad>
Sebastian Morr <sebastian@morr.cc> writes:
> This bugged me: In a new, empty repository:
>
> $ git stash
> fatal: bad revision 'HEAD'
> fatal: bad revision 'HEAD'
> fatal: Needed a single revision
> You do not have the initial commit yet
>
> With this patch:
>
> $ git stash
> You do not have the initial commit yet
Yeah, that looks tidier.
> With the --quiet option, I wouldn't expect diff-index to print error
> messages.
Even with --quiet, an error is an error.
Asking for a diff with the current HEAD when you do not have one yet _is_
an error and "diff-index" is correct to report the error. The bug
(i.e. "git stash" shows that error message) is in the program that calls
diff-index when the operation does not make sense.
"Hiding error" is not desirable, especially if it is only for giving a
cleaner error message for a narrow corner case that nobody cares
(i.e. running "stash" when you do not have any commit to go back to), with
the side effect that it hides _real_ errors that may help users notice
unusual situation (e.g. corrupted index file).
Probably the right way to fix it is to check if HEAD is a valid commit
before running any command that requires to have a valid HEAD (i.e.
create and save would need one; list, show, etc. would not) and give that
"You do not have the initial commit yet" message, before passing the
control to the implementations of these individual subcommands, without
touching the places you touched in this patch.
> no_changes () {
> - git diff-index --quiet --cached HEAD --ignore-submodules -- &&
> + git diff-index --quiet --cached HEAD --ignore-submodules -- 2>/dev/null &&
> git diff-files --quiet --ignore-submodules &&
> (test -z "$untracked" || test -z "$(untracked_files)")
> }
> @@ -67,7 +67,7 @@ create_stash () {
> fi
>
> # state of the base commit
> - if b_commit=$(git rev-parse --verify HEAD)
> + if b_commit=$(git rev-parse --quiet --verify HEAD)
> then
> head=$(git rev-list --oneline -n 1 HEAD --)
> else
^ permalink raw reply
* Re: Is it "GIT" or "Git" or "git"? Standardize documentation?
From: Junio C Hamano @ 2011-12-14 1:02 UTC (permalink / raw)
To: Sebastian Morr; +Cc: git
In-Reply-To: <20111214004332.GA8464@thinkpad>
Sebastian Morr <sebastian@morr.cc> writes:
> Okay, I'd like to hear opinions on this before creating a patch.
>
> My perception is that "Git" is the name of the software, whereas "git"
> is used to refer to the actual command.
And "GIT" is used interchangeably with "Git" whenever the document author
feels like it warrants a bit more visibility than usual in the context.
Think of it as typesetting in a font with small-caps or something ;-).
^ permalink raw reply
* Re: Is it "GIT" or "Git" or "git"? Standardize documentation?
From: Andreas Ericsson @ 2011-12-14 1:01 UTC (permalink / raw)
To: Sebastian Morr; +Cc: git
In-Reply-To: <20111214004332.GA8464@thinkpad>
On 12/14/2011 01:43 AM, Sebastian Morr wrote:
> Okay, I'd like to hear opinions on this before creating a patch.
>
> My perception is that "Git" is the name of the software, whereas "git"
> is used to refer to the actual command. But "GIT" is all over the
> documentation as well, most prominently at the top of README.
> Would anyone mind if we replaced all occurrences of "GIT" in the
> documentation with "Git"?
> I suppose the release notes shouldn't be touched for historical reasons.
>
I doubt anyone cares all that much. I for one have absolutely no clue
what you're talking about, but if you think it looks better one way
than the other and care about it enough, just make the patch and send
it in for review. Consensus is never reached before there's code, and
hardly ever after either, but discussing something that *might* happen
and still doesn't affect my daily life feels utterly pointless.
> Completely unrelated: Why is it "Documentation/RelNotes" and not
> something like "documentation/release-notes"? Almost everything else is
> spelled either all-lower- or all-uppercase.
>
For tab-completion and directory listing reasons. Uppercase-D+tab puts
you in the right directory and uppercasing RelNotes makes it easy to
find among its many companions in that directory. It's fairly standard
procedure in the unix world to uppercase or camelcase the more important
documents, and especially when there's more than a small handful of files
in a single directory.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply
* Is it "GIT" or "Git" or "git"? Standardize documentation?
From: Sebastian Morr @ 2011-12-14 0:43 UTC (permalink / raw)
To: git
Okay, I'd like to hear opinions on this before creating a patch.
My perception is that "Git" is the name of the software, whereas "git"
is used to refer to the actual command. But "GIT" is all over the
documentation as well, most prominently at the top of README.
Would anyone mind if we replaced all occurrences of "GIT" in the
documentation with "Git"?
I suppose the release notes shouldn't be touched for historical reasons.
Completely unrelated: Why is it "Documentation/RelNotes" and not
something like "documentation/release-notes"? Almost everything else is
spelled either all-lower- or all-uppercase.
Sorry for being such a nazi...
^ permalink raw reply
* Re: [PATCH] Revert "http: don't always prompt for password"
From: Junio C Hamano @ 2011-12-14 0:33 UTC (permalink / raw)
To: Jeff King; +Cc: Stefan Naewe, Sebastian Schuberth, Eric, git, msysgit
In-Reply-To: <20111214001156.GA21940@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> ... This
> patch does a quick fix of re-enabling the "proactive auth"
> strategy only for http-push, leaving the dumb http fetch and
> smart-http as-is.
Yeah, I somehow like this better. Thanks.
^ permalink raw reply
* Re: [PATCH v2 28/51] refs.c: rename ref_array -> ref_dir
From: Junio C Hamano @ 2011-12-14 0:19 UTC (permalink / raw)
To: Michael Haggerty
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips
In-Reply-To: <7vzkewt5qu.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
>> Namely, we should figure out what code wants to set extra refs and or
>> wants to include extra refs in its iteration over references. The
>> setters don't have to be changed, but the readers should be.
>
> You read me correctly. That is exactly what I meant by "extra ref API" in
> my earlier response.
Actually, I do not think it even needs to be the "extra *REF* API". The
only thing that matters is that these commits are considered to be extra
anchor point in the history, in addition to the usual rule of considering
that everything reachable from our refs is complete. The data structure to
hold them does not even have to be a "struct ref". Just an array of object
names (or "struct object *") should suffice.
^ permalink raw reply
* [PATCH] stash: Fix multiple error messages on create if no HEAD
From: Sebastian Morr @ 2011-12-14 0:14 UTC (permalink / raw)
To: git
create_stash() checks whether HEAD is valid via rev-parse. If this is
not the case, both itself as well as rev-parse print an error message.
Make rev-parse quiet.
In no_changes(), diff-index is called, which dies unquietly if there is
no commit. Hide it's stderr.
Signed-off-by: Sebastian Morr <sebastian@morr.cc>
---
This bugged me: In a new, empty repository:
$ git stash
fatal: bad revision 'HEAD'
fatal: bad revision 'HEAD'
fatal: Needed a single revision
You do not have the initial commit yet
With this patch:
$ git stash
You do not have the initial commit yet
With the --quiet option, I wouldn't expect diff-index to print error
messages. But it does so (via revision.c, setup_revisions()). Is this
wanted?
git-stash.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index c766692..07b6511 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -34,7 +34,7 @@ else
fi
no_changes () {
- git diff-index --quiet --cached HEAD --ignore-submodules -- &&
+ git diff-index --quiet --cached HEAD --ignore-submodules -- 2>/dev/null &&
git diff-files --quiet --ignore-submodules &&
(test -z "$untracked" || test -z "$(untracked_files)")
}
@@ -67,7 +67,7 @@ create_stash () {
fi
# state of the base commit
- if b_commit=$(git rev-parse --verify HEAD)
+ if b_commit=$(git rev-parse --quiet --verify HEAD)
then
head=$(git rev-list --oneline -n 1 HEAD --)
else
--
1.7.8.168.gd6118.dirty
^ permalink raw reply related
* Re: [PATCH 2/2] Makefile: optionally exclude code that needs Unix sockets
From: Junio C Hamano @ 2011-12-14 0:14 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, Jeff King, git
In-Reply-To: <4EE7AEDA.6090509@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
> Am 13.12.2011 01:45, schrieb Junio C Hamano:
>> I'll queue a single patch that is a squash between 2/2 and Peff's test
>> updates between "credentials: add "cache" helper" and "strbuf: add
>> strbuf_add*_urlencode" in the series.
>
> Thanks. The resulting series builds fine on Windows and passes/skips the
> new tests in the expected manner.
Thanks. Let's advance the topic forward then.
^ permalink raw reply
* [REQUEST PULL] git-gui
From: Pat Thoyts @ 2011-12-14 0:05 UTC (permalink / raw)
To: Git; +Cc: Junio C Hamano
The following changes since commit 843d6597fbacfae02b8af7d6840992c92d0863f8:
git-gui: incremental goto line in blame view (2011-10-15 23:14:13 +0100)
are available in the git repository at:
git://repo.or.cz/git-gui.git master
for you to fetch changes up to 942e6baa92846e5628752c65a22bc4957d8de4d0:
git-gui 0.16 (2011-12-13 23:44:30 +0000)
----------------------------------------------------------------
Bert Wesarg (14):
git-gui: fix multi selected file operation
git-gui: handle config booleans without value
git-gui: add smart case search mode in searchbar
git-gui: add regexp search mode to the searchbar
git-gui: add search history to searchbar
git-gui: fix unintended line break in message string
git-gui: use "untracked" for files which are not known to git
git-gui: new config to control staging of untracked files
git-gui: fix display of path in browser title
git-gui: use a tristate to control the case mode in the searchbar
git-gui: span widgets over the full file output area in the blame view
git-gui: include the file path in guitools confirmation dialog
git-gui: make config gui.warndetachedcommit a boolean
git-gui: don't warn for detached head when rebasing
Dejan Ribič (1):
git-gui: fix spelling error in sshkey.tcl
Pat Thoyts (12):
git-gui: include the number of untracked files to stage when asking the user
git-gui: theme the search and line-number entry fields on blame screen
git-gui: catch invalid or complete regular expressions and treat as no match.
git-gui: enable the smart case sensitive search only if gui.search.smartcase is true
Merge branch 'bw/searching'
git-gui: set suitable extended window manager hints.
git-gui: support underline style when parsing diff output
git-gui: sort the numeric ansi codes
git-gui: set whitespace warnings appropriate to this project
git-gui: added config gui.gcwarning to disable the gc hint message
git-gui: handle shell script text filters when loading for blame.
git-gui 0.16
Samuel Bronson (1):
git-gui: Set both 16x16 and 32x32 icons on X to pacify Xming.
Tilman Vogel (1):
git-gui: add config value gui.diffopts for passing additional diff options
.gitattributes | 1 +
GIT-VERSION-GEN | 2 +-
git-gui.sh | 56 ++++++++++++++++++++++--
lib/blame.tcl | 29 ++++++------
lib/browser.tcl | 8 +++-
lib/choose_rev.tcl | 1 +
lib/class.tcl | 1 +
lib/commit.tcl | 4 +-
lib/diff.tcl | 5 +-
lib/index.tcl | 24 ++++++++---
lib/line.tcl | 2 +-
lib/option.tcl | 20 ++++++++
lib/search.tcl | 123 ++++++++++++++++++++++++++++++++++++++++++++++-----
lib/sshkey.tcl | 2 +-
lib/themed.tcl | 99 ++++++++++++++++++++++++++++++++++++++++--
lib/tools.tcl | 10 +++-
lib/transport.tcl | 1 +
17 files changed, 339 insertions(+), 49 deletions(-)
^ permalink raw reply
* Re: [PATCH] Revert "http: don't always prompt for password"
From: Jeff King @ 2011-12-14 0:11 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Stefan Naewe, Sebastian Schuberth, Eric, git, msysgit
In-Reply-To: <20111213232053.GE12432@sigill.intra.peff.net>
On Tue, Dec 13, 2011 at 06:20:53PM -0500, Jeff King wrote:
> BTW, one other solution, rather than reverting Stefan's patch, is to
> just re-add the "unconditionally ask for a password" behavior back to
> git-http-push, but not to the fetching side. Especially if we hope to
> kill off git-http-push soon (after a deprecation period presumably),
> then that lets it work in the meantime without hurting the other http
> code. And it's really easy to do.
And here's what that patch looks like.
Thinking on it more, this is probably better for a maint release than
reverting Stefan's patch. It un-breaks http-push, and they are no
differently off than they are with the revert. But it leaves the
enhancement in place for the smart-http code.
-- >8 --
Subject: [PATCH] http-push: enable "proactive auth"
Before commit 986bbc08, git was proactive about asking for
http passwords. It assumed that if you had a username in
your URL, you would also want a password, and asked for it
before making any http requests.
However, this could interfere with the use of .netrc (see
986bbc08 for details). And it was also unnecessary, since
the http fetching code had learned to recognize an HTTP 401
and prompt the user then. Furthermore, the proactive prompt
could interfere with the usage of .netrc (see 986bbc08 for
details).
Unfortunately, the http push-over-DAV code never learned to
recognize HTTP 401, and so was broken by this change. This
patch does a quick fix of re-enabling the "proactive auth"
strategy only for http-push, leaving the dumb http fetch and
smart-http as-is.
Signed-off-by: Jeff King <peff@peff.net>
---
http-fetch.c | 2 +-
http-push.c | 2 +-
http.c | 8 +++++++-
http.h | 3 ++-
remote-curl.c | 2 +-
t/t5540-http-push.sh | 2 +-
6 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/http-fetch.c b/http-fetch.c
index 69299b7..94d47cb 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -67,7 +67,7 @@ int main(int argc, const char **argv)
git_config(git_default_config, NULL);
- http_init(NULL, url);
+ http_init(NULL, url, 0);
walker = get_http_walker(url);
walker->get_tree = get_tree;
walker->get_history = get_history;
diff --git a/http-push.c b/http-push.c
index 5d01be9..70283e6 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1820,7 +1820,7 @@ int main(int argc, char **argv)
memset(remote_dir_exists, -1, 256);
- http_init(NULL, repo->url);
+ http_init(NULL, repo->url, 1);
#ifdef USE_CURL_MULTI
is_running_queue = 0;
diff --git a/http.c b/http.c
index 008ad72..6c90092 100644
--- a/http.c
+++ b/http.c
@@ -43,6 +43,7 @@
static const char *curl_http_proxy;
static const char *curl_cookie_file;
static char *user_name, *user_pass, *description;
+static int http_proactive_auth;
static const char *user_agent;
#if LIBCURL_VERSION_NUM >= 0x071700
@@ -279,6 +280,9 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
#endif
+ if (http_proactive_auth)
+ init_curl_http_auth(result);
+
if (ssl_cert != NULL)
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
if (has_cert_password())
@@ -367,7 +371,7 @@ static void set_from_env(const char **var, const char *envname)
*var = val;
}
-void http_init(struct remote *remote, const char *url)
+void http_init(struct remote *remote, const char *url, int proactive_auth)
{
char *low_speed_limit;
char *low_speed_time;
@@ -378,6 +382,8 @@ void http_init(struct remote *remote, const char *url)
curl_global_init(CURL_GLOBAL_ALL);
+ http_proactive_auth = proactive_auth;
+
if (remote && remote->http_proxy)
curl_http_proxy = xstrdup(remote->http_proxy);
diff --git a/http.h b/http.h
index 3c332a9..51f6ba7 100644
--- a/http.h
+++ b/http.h
@@ -86,7 +86,8 @@ struct buffer {
extern void step_active_slots(void);
#endif
-extern void http_init(struct remote *remote, const char *url);
+extern void http_init(struct remote *remote, const char *url,
+ int proactive_auth);
extern void http_cleanup(void);
extern int data_received;
diff --git a/remote-curl.c b/remote-curl.c
index 0e720ee..0757b19 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -859,7 +859,7 @@ int main(int argc, const char **argv)
url = strbuf_detach(&buf, NULL);
- http_init(remote, url);
+ http_init(remote, url, 0);
do {
if (strbuf_getline(&buf, stdin, '\n') == EOF) {
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 3300227..1eea647 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -160,7 +160,7 @@ test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
"$ROOT_PATH"/test_repo_clone master
-test_expect_failure 'push to password-protected repository (user in URL)' '
+test_expect_success 'push to password-protected repository (user in URL)' '
test_commit pw-user &&
git push "$HTTPD_URL_USER/auth/dumb/test_repo.git" HEAD &&
git rev-parse --verify HEAD >expect &&
--
1.7.8.17.gfd3524
^ permalink raw reply related
* Re: [PATCH 2/2] push: --ignore-stale option
From: Andreas Ericsson @ 2011-12-13 23:48 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vobvct58u.fsf@alter.siamese.dyndns.org>
On 12/14/2011 12:35 AM, Junio C Hamano wrote:
>
> You however should be testing these 7 before pushing them out anyway,
> and the sane way to do so is to check one out, test it, push it, and
> iterate that sequence 7 times. If you do so, a workable alternative is
> to use the configuration to push the current branch and you do not need
> this patch series at all.
>
> Perhaps this series encourages a wrong workflow in that sense. I dunno.
>
I for one really love it and will probably make an alias to use for most of
my repos. With 'maint' branches (with topics) being worked on by one team and
'master' (with topics) being worked on by a different group, but all branches
generally checked out, tracked and touched by everyone sooner or later, I've
come to just ignore the "not fast-forward" error. I've never stopped loathing
it though, since git should just *know* that it doesn't fast-forward because
I haven't done anything and not because I've done something (and maybe
forgotten to push) and someone else has done something different, which would
actually be interesting for me to know.
So big thumbs up and three loud "hurrah"'s for this.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply
* [PATCH 2/2] push: --ignore-stale option
From: Junio C Hamano @ 2011-12-13 23:35 UTC (permalink / raw)
To: git
If you forked many local branches that are not active from a shared
'origin' repository, it is sometimes convenient to say "I know many of my
branches are stale, so do not push them, but push ones that have my own
work". Using the usual 'matching refs' semantics that is designed for the
workflow to push into your own publishing repository is not suitable for
this purpose as-is, because many of your local branches are likely to have
been made stale by other people pushing into the same shared repository,
triggering 'no fast-forward' errors.
Teach a new "--ignore-stale" option to "git push" which tells it not to
push stale refs (i.e. the commit that would have been pushed without the
option is an ancestor of the commit that is at the destination). With this,
a lazy workflow could be like this:
$ git clone <<origin>>
$ git checkout -b topic1 origin/topic1
$ work work work
$ git push origin :
$ git checkout -b topic2 origin/topic2
$ work work work
$ git push --ignore-stale origin :
and the second push does not have to worry about other people working on
topic1 and updating it in the central repository while you haven't touched
the corresponding local branch at all.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* You may end up having 47 local branches, 7 of them worked on recently
and none of them pushed yet, which requires you to remember which 7 of
them you need to push among 47. The reason you left these 7 unpushed
even though you checked out other branches at least 6 times after
making the last commit on these branches is probably because you wanted
to make sure everything is in good order, delaying the pushout as much
as possible, which by itself is a good discipline.
You however should be testing these 7 before pushing them out anyway,
and the sane way to do so is to check one out, test it, push it, and
iterate that sequence 7 times. If you do so, a workable alternative is
to use the configuration to push the current branch and you do not need
this patch series at all.
Perhaps this series encourages a wrong workflow in that sense. I dunno.
Documentation/git-push.txt | 10 +++++++++-
builtin/push.c | 1 +
builtin/send-pack.c | 7 +++++++
cache.h | 1 +
remote.c | 20 ++++++++++++++++++++
t/t5516-fetch-push.sh | 31 +++++++++++++++++++++++++++++++
transport.c | 6 ++++++
transport.h | 1 +
8 files changed, 76 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index aede488..f2b5ee2 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git push' [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
[--repo=<repository>] [-f | --force] [-v | --verbose] [-u | --set-upstream]
- [<repository> [<refspec>...]]
+ [--ignore-stale] [<repository> [<refspec>...]]
DESCRIPTION
-----------
@@ -114,6 +114,14 @@ nor in any Push line of the corresponding remotes file---see below).
This flag disables the check. This can cause the
remote repository to lose commits; use it with care.
+--ignore-stale::
+ When the commit that is pushed is known to be an ancestor of the
+ commit that is at the remote ref, exclude it from the push
+ request. This can be used with the "matching" semantics to push
+ out only the branches that have your own work, when you know many
+ of your branches since they were forked from their upstream are
+ untouched and stale.
+
--repo=<repository>::
This option is only relevant if no <repository> argument is
passed in the invocation. In this case, 'git push' derives the
diff --git a/builtin/push.c b/builtin/push.c
index 35cce53..165d2be 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -261,6 +261,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
OPT_BIT('u', "set-upstream", &flags, "set upstream for git pull/status",
TRANSPORT_PUSH_SET_UPSTREAM),
OPT_BOOLEAN(0, "progress", &progress, "force progress reporting"),
+ OPT_BIT(0, "ignore-stale", &flags, "ignore stale refs", TRANSPORT_PUSH_IGNORE_STALE),
OPT_END()
};
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index ec107ed..0cfc69a 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -196,6 +196,11 @@ static void print_helper_status(struct ref *ref)
msg = "up to date";
break;
+ case REF_STATUS_STALE:
+ res = "ok";
+ msg = "ignored stale";
+ break;
+
case REF_STATUS_REJECT_NONFASTFORWARD:
res = "error";
msg = "non-fast forward";
@@ -282,6 +287,7 @@ int send_pack(struct send_pack_args *args,
switch (ref->status) {
case REF_STATUS_REJECT_NONFASTFORWARD:
case REF_STATUS_UPTODATE:
+ case REF_STATUS_STALE:
continue;
default:
; /* do nothing */
@@ -379,6 +385,7 @@ int send_pack(struct send_pack_args *args,
switch (ref->status) {
case REF_STATUS_NONE:
case REF_STATUS_UPTODATE:
+ case REF_STATUS_STALE:
case REF_STATUS_OK:
break;
default:
diff --git a/cache.h b/cache.h
index 8c98d05..696805d 100644
--- a/cache.h
+++ b/cache.h
@@ -1009,6 +1009,7 @@ struct ref {
REF_STATUS_OK,
REF_STATUS_REJECT_NONFASTFORWARD,
REF_STATUS_REJECT_NODELETE,
+ REF_STATUS_STALE,
REF_STATUS_UPTODATE,
REF_STATUS_REMOTE_REJECT,
REF_STATUS_EXPECTING_REPORT
diff --git a/remote.c b/remote.c
index 95d7f37..9c63426 100644
--- a/remote.c
+++ b/remote.c
@@ -1224,11 +1224,25 @@ int match_push_refs(struct ref *src, struct ref **dst,
return 0;
}
+/*
+ * Do we know if the other side has newer commit than what we are
+ * trying to push (i.e. old_sha1 is descendant of new_sha1)? If so
+ * just ignore the request to push this particular bref under the
+ * "--ignore-stale" option.
+ */
+static int is_stale_push(unsigned char *old_sha1, unsigned char *new_sha1)
+{
+ if (!has_sha1_file(old_sha1) || !has_sha1_file(new_sha1))
+ return 0;
+ return ref_newer(old_sha1, new_sha1);
+}
+
void set_ref_status_for_push(struct ref *remote_refs, unsigned flags)
{
struct ref *ref;
int send_mirror = flags & TRANSPORT_PUSH_MIRROR;
int force_update = flags & TRANSPORT_PUSH_FORCE;
+ int ignore_stale = flags & TRANSPORT_PUSH_IGNORE_STALE;
for (ref = remote_refs; ref; ref = ref->next) {
if (ref->peer_ref)
@@ -1243,6 +1257,12 @@ void set_ref_status_for_push(struct ref *remote_refs, unsigned flags)
continue;
}
+ if (ignore_stale && !ref->deletion &&
+ is_stale_push(ref->old_sha1, ref->new_sha1)) {
+ ref->status = REF_STATUS_STALE;
+ continue;
+ }
+
/* This part determines what can overwrite what.
* The rules are:
*
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index b69cf57..c925640 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -979,4 +979,35 @@ test_expect_success 'push --porcelain --dry-run rejected' '
test_cmp .git/foo .git/bar
'
+test_expect_success 'push --ignore-stale' '
+ mk_empty &&
+ (
+ cd testrepo &&
+ git fetch --update-head-ok .. "refs/heads/*:refs/heads/*" &&
+ git checkout -b next master &&
+ git commit --allow-empty -m "updated next" &&
+ git push . next:master &&
+ git for-each-ref >../snapshot.before
+ ) &&
+ git checkout branch1 &&
+ git commit --allow-empty -m "updated branch1" &&
+ test_must_fail git push testrepo : &&
+ git fetch testrepo "+refs/heads/*:refs/remotes/origin/*" &&
+ git push --ignore-stale testrepo : &&
+ (
+ cd testrepo &&
+ git for-each-ref >../snapshot.after
+ ) &&
+
+ # branch1 must be updated and master must stay the same
+ git for-each-ref refs/heads/branch1 >expect &&
+ grep refs/heads/branch1 snapshot.after >actual &&
+ test_cmp expect actual &&
+
+ grep refs/heads/master snapshot.before >expect &&
+ grep refs/heads/master snapshot.after >actual &&
+ test_cmp expect actual
+
+'
+
test_done
diff --git a/transport.c b/transport.c
index 95556da..d124d70 100644
--- a/transport.c
+++ b/transport.c
@@ -566,6 +566,7 @@ static int push_had_errors(struct ref *ref)
for (; ref; ref = ref->next) {
switch (ref->status) {
case REF_STATUS_NONE:
+ case REF_STATUS_STALE:
case REF_STATUS_UPTODATE:
case REF_STATUS_OK:
break;
@@ -581,6 +582,7 @@ int transport_refs_pushed(struct ref *ref)
for (; ref; ref = ref->next) {
switch(ref->status) {
case REF_STATUS_NONE:
+ case REF_STATUS_STALE:
case REF_STATUS_UPTODATE:
break;
default:
@@ -690,6 +692,10 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count, i
print_ref_status('=', "[up to date]", ref,
ref->peer_ref, NULL, porcelain);
break;
+ case REF_STATUS_STALE:
+ print_ref_status('=', "[stale ignored]", ref,
+ ref->peer_ref, NULL, porcelain);
+ break;
case REF_STATUS_REJECT_NONFASTFORWARD:
print_ref_status('!', "[rejected]", ref, ref->peer_ref,
"non-fast-forward", porcelain);
diff --git a/transport.h b/transport.h
index 059b330..5db8d23 100644
--- a/transport.h
+++ b/transport.h
@@ -102,6 +102,7 @@ struct transport {
#define TRANSPORT_PUSH_PORCELAIN 16
#define TRANSPORT_PUSH_SET_UPSTREAM 32
#define TRANSPORT_RECURSE_SUBMODULES_CHECK 64
+#define TRANSPORT_PUSH_IGNORE_STALE 128
#define TRANSPORT_SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)
--
1.7.8.249.gb1b73
^ permalink raw reply related
* [PATCH 1/2] set_ref_status_for_push(): use transport-flags abstraction
From: Junio C Hamano @ 2011-12-13 23:26 UTC (permalink / raw)
To: git
It does not make much sense to have separate "int" parameters to
this function with two callsites (why do we need to to begin with?
but that is a separate issue) and having to update them every time
we need to touch it.
Consolidate them into a single "flags" parameter to make it easier
to extend later.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* A preparatory step for the next one
builtin/send-pack.c | 10 ++++++++--
remote.c | 6 ++++--
remote.h | 3 +--
transport.c | 4 +---
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index e0b8030..ec107ed 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -404,6 +404,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
int send_all = 0;
const char *receivepack = "git-receive-pack";
int flags;
+ unsigned transport_flags;
int nonfastforward = 0;
argv++;
@@ -512,8 +513,13 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
if (match_push_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags))
return -1;
- set_ref_status_for_push(remote_refs, args.send_mirror,
- args.force_update);
+ transport_flags = 0;
+ if (args.send_mirror)
+ transport_flags |= TRANSPORT_PUSH_MIRROR;
+ if (args.force_update)
+ transport_flags |= TRANSPORT_PUSH_FORCE;
+
+ set_ref_status_for_push(remote_refs, transport_flags);
ret = send_pack(&args, fd, conn, remote_refs, &extra_have);
diff --git a/remote.c b/remote.c
index 6655bb0..95d7f37 100644
--- a/remote.c
+++ b/remote.c
@@ -7,6 +7,7 @@
#include "dir.h"
#include "tag.h"
#include "string-list.h"
+#include "transport.h"
static struct refspec s_tag_refspec = {
0,
@@ -1223,10 +1224,11 @@ int match_push_refs(struct ref *src, struct ref **dst,
return 0;
}
-void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
- int force_update)
+void set_ref_status_for_push(struct ref *remote_refs, unsigned flags)
{
struct ref *ref;
+ int send_mirror = flags & TRANSPORT_PUSH_MIRROR;
+ int force_update = flags & TRANSPORT_PUSH_FORCE;
for (ref = remote_refs; ref; ref = ref->next) {
if (ref->peer_ref)
diff --git a/remote.h b/remote.h
index b395598..0cf3c07 100644
--- a/remote.h
+++ b/remote.h
@@ -98,8 +98,7 @@ char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
int match_push_refs(struct ref *src, struct ref **dst,
int nr_refspec, const char **refspec, int all);
-void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
- int force_update);
+void set_ref_status_for_push(struct ref *remote_refs, unsigned flags);
/*
* Given a list of the remote refs and the specification of things to
diff --git a/transport.c b/transport.c
index 51814b5..95556da 100644
--- a/transport.c
+++ b/transport.c
@@ -1031,9 +1031,7 @@ int transport_push(struct transport *transport,
return -1;
}
- set_ref_status_for_push(remote_refs,
- flags & TRANSPORT_PUSH_MIRROR,
- flags & TRANSPORT_PUSH_FORCE);
+ set_ref_status_for_push(remote_refs, flags);
if ((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) && !is_bare_repository()) {
struct ref *ref = remote_refs;
--
1.7.8.249.gb1b73
^ permalink raw reply related
* Re: [PATCH v2 28/51] refs.c: rename ref_array -> ref_dir
From: Junio C Hamano @ 2011-12-13 23:24 UTC (permalink / raw)
To: Michael Haggerty
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips
In-Reply-To: <4EE7CDF2.3040408@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
>>> .... For example, extra refs added in builtin/clone.c is used by
>>> builtin/fetch-pack.c, meaning that the codepath that discovers and
>>> remembers these extra history anchor points and the codepath that uses
>>> them while walking the history are not localized and we would need some
>>> sort of "extra ref API" anyway. I am leaning towards this option.
> ...
> Namely, we should figure out what code wants to set extra refs and or
> wants to include extra refs in its iteration over references. The
> setters don't have to be changed, but the readers should be.
You read me correctly. That is exactly what I meant by "extra ref API" in
my earlier response.
> ... But there are so many calls to the
> for_each_ref*() family of functions that I wasn't able to determine
> exactly which should allow for extra refs and which shouldn't.
Only the ones that follow add_extra_ref() in the control flow.
builtin/clone.c adds them in setup_reference() to deal with --reference.
The objects known to be complete in these repositories we borrow from
need to be marked complete on our end (i.e. clone does not have to fetch)
and transport_fetch_refs() that eventually goes to fetch_refs_via_pack()
that calls fetch_pack() uses this information. All three for_each_ref()
calls in builtin/fetch-pack.c are about "what are the objects that we know
are complete?" and needs to pay attention to extra refs.
Having said that, I have a slight suspicion that you might be able to
eliminate this one in clone. setup_reference() adds the reference
repository to the $GIT_DIR/objects/info/alternates, and the fetch logic
already knows to account for the refs in alternate repositories via
insert_alternate_refs() callchain.
builtin/receive-pack.c adds them in add_alternate_refs() to deal with the
repositories listed in $GIT_DIR/objects/info/alternates in the receiving
end of a push. Again, the objects known to be complete in these
repositories we borrow from need to be marked complete on our end, and
write_head_info() in that function sends these extras together with real
refs we have.
^ permalink raw reply
* Re: [PATCH] Revert "http: don't always prompt for password"
From: Jeff King @ 2011-12-13 23:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Stefan Naewe, Sebastian Schuberth, Eric, git, msysgit
In-Reply-To: <20111213231909.GD12432@sigill.intra.peff.net>
On Tue, Dec 13, 2011 at 06:19:09PM -0500, Jeff King wrote:
> > Or just let the "dumb HTTP" die.
> >
> > I thought push over DAV has long been dead; is anybody using it for real?
>
> For the record, I have no problem whatsoever with letting it die. I just
> think we probably shouldn't do it accidentally during a release. ;)
BTW, one other solution, rather than reverting Stefan's patch, is to
just re-add the "unconditionally ask for a password" behavior back to
git-http-push, but not to the fetching side. Especially if we hope to
kill off git-http-push soon (after a deprecation period presumably),
then that lets it work in the meantime without hurting the other http
code. And it's really easy to do.
-Peff
^ permalink raw reply
* Re: [PATCH] Revert "http: don't always prompt for password"
From: Jeff King @ 2011-12-13 23:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Stefan Naewe, Sebastian Schuberth, Eric, git, msysgit
In-Reply-To: <7vaa6wuqjt.fsf@alter.siamese.dyndns.org>
On Tue, Dec 13, 2011 at 01:09:42PM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > Doing (3) is obviously the easiest thing. And given the complexity of
> > the other two solutions, I think it makes sense to revert 986bbc08
> > (i.e., apply this patch), ship a working v1.7.8.1, and then look at
> > doing one of the other two solutions for v1.7.9.
>
> Or just let the "dumb HTTP" die.
>
> I thought push over DAV has long been dead; is anybody using it for real?
For the record, I have no problem whatsoever with letting it die. I just
think we probably shouldn't do it accidentally during a release. ;)
-Peff
^ permalink raw reply
* Re: [PATCH] Revert "http: don't always prompt for password"
From: Jeff King @ 2011-12-13 23:18 UTC (permalink / raw)
To: Eric Advincula
Cc: Junio C Hamano, Stefan Naewe, Sebastian Schuberth, git, msysgit
In-Reply-To: <CA+e6NDTQNEJB6Y17ow+yuLp2Bc799wsyQdnS8immMDYdCEyCGA@mail.gmail.com>
On Tue, Dec 13, 2011 at 02:22:12PM -0700, Eric Advincula wrote:
> Is there an alternative to using git on windows? I used windows, apache,
> dav for git.
> If there is a better solution please let me know.
I don't know the status of running the smart-http backend on Windows,
but that would be a preferable solution. It's way more efficient, and
the client half of the code is better maintained.
See "git help http-backend" for documentation.
-Peff
^ permalink raw reply
* Re: [PATCH 1/2] t5540: test DAV push with authentication
From: Jeff King @ 2011-12-13 23:16 UTC (permalink / raw)
To: Sebastian Schuberth; +Cc: Junio C Hamano, Stefan Naewe, Eric, git, msysgit
In-Reply-To: <CAHGBnuO1CFGacMQb+Md_uGsLu=V9bGDpcFLd9Lb4C5jSN+uUiw@mail.gmail.com>
On Tue, Dec 13, 2011 at 10:28:07PM +0100, Sebastian Schuberth wrote:
> On Tue, Dec 13, 2011 at 21:17, Jeff King <peff@peff.net> wrote:
>
> > We don't currently test this case at all, and instead just
> > test the DAV mechanism over an unauthenticated push. That
> > isn't very realistic, as most people will want to
> > authenticate pushes.
>
> Thanks for adding this, Peff!
You're welcome. Thank you for forwarding the bug report. I would never
have seen it on the msysgit list, and for some reason it seems that
msysgit people are more likely to use DAV.
Having looked a lot at the http code the past month or two, I knew it
was pretty flaky and I was nervous when we added Stefan's patch (and no,
I don't blame Stefan; his patch was completely reasonable, but just
happened to trigger a problem in a seldom-looked-at corner of the code).
But I hadn't looked at http-push at all until yesterday, and it didn't
even occur to me that there was another whole area of code relying in a
very obscure way on the http.c auth code. I'll take a look at some of
the refactoring I've done in http.c (both for the credentials topic as
well as the bundle topic) and see if we can't integrate http-push.c a
little more smoothly.
-Peff
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox