<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/push.c, branch v2.30.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.30.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.30.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-10-27T22:09:49Z</updated>
<entry>
<title>Merge branch 'sk/force-if-includes'</title>
<updated>2020-10-27T22:09:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-10-27T22:09:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=de0a7effc86aadf6177fdcea52b5ae24c7a85911'/>
<id>urn:sha1:de0a7effc86aadf6177fdcea52b5ae24c7a85911</id>
<content type='text'>
"git push --force-with-lease[=&lt;ref&gt;]" can easily be misused to lose
commits unless the user takes good care of their own "git fetch".
A new option "--force-if-includes" attempts to ensure that what is
being force-pushed was created after examining the commit at the
tip of the remote ref that is about to be force-replaced.

* sk/force-if-includes:
  t, doc: update tests, reference for "--force-if-includes"
  push: parse and set flag for "--force-if-includes"
  push: add reflog check for "--force-if-includes"
</content>
</entry>
<entry>
<title>push: parse and set flag for "--force-if-includes"</title>
<updated>2020-10-03T16:59:19Z</updated>
<author>
<name>Srinidhi Kaushik</name>
<email>shrinidhi.kaushik@gmail.com</email>
</author>
<published>2020-10-03T12:10:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3b990aa645d1169b7373d12cbf1511ca4633e349'/>
<id>urn:sha1:3b990aa645d1169b7373d12cbf1511ca4633e349</id>
<content type='text'>
The previous commit added the necessary machinery to implement the
"--force-if-includes" protection, when "--force-with-lease" is used
without giving exact object the remote still ought to have. Surface
the feature by adding a command line option and a configuration
variable to enable it.

 - Add a flag: "TRANSPORT_PUSH_FORCE_IF_INCLUDES" to indicate that the
   new option was passed from the command line of via configuration
   settings; update command line and configuration parsers to set the
   new flag accordingly.

 - Introduce a new configuration option "push.useForceIfIncludes", which
   is equivalent to setting "--force-if-includes" in the command line.

 - Update "remote-curl" to recognize and pass this option to "send-pack"
   when enabled.

 - Update "advise" to catch the reject reason "REJECT_REF_NEEDS_UPDATE",
   set when the ref status is "REF_STATUS_REJECT_REMOTE_UPDATED" and
   (optionally) print a help message when the push fails.

 - The new option is a "no-op" in the following scenarios:
    * When used without "--force-with-lease".
    * When used with "--force-with-lease", and if the expected commit
      on the remote side is specified as an argument.

Signed-off-by: Srinidhi Kaushik &lt;shrinidhi.kaushik@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>push: drop unused repo argument to do_push()</title>
<updated>2020-09-30T19:53:47Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-09-30T12:29:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5b9427e0ac4d4b6c96f23fc5eb9b047a27563c65'/>
<id>urn:sha1:5b9427e0ac4d4b6c96f23fc5eb9b047a27563c65</id>
<content type='text'>
We stopped using the "repo" argument in 8e4c8af058 (push: disallow --all
and refspecs when remote.&lt;name&gt;.mirror is set, 2019-09-02), which moved
the pushremote handling to its caller.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refspec: add and use refspec_appendf()</title>
<updated>2020-09-06T20:15:46Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2020-09-05T14:49:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1af8b8c0a570ee0b12a19fdd920a3ea09fb22a75'/>
<id>urn:sha1:1af8b8c0a570ee0b12a19fdd920a3ea09fb22a75</id>
<content type='text'>
Add a function for building a refspec using printf-style formatting.  It
frees callers from managing their own buffer.  Use it throughout the
tree to shorten and simplify its callers.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>push: release strbufs used for refspec formatting</title>
<updated>2020-09-06T20:15:45Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2020-09-05T14:47:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=30035d9c66bc2a52352e3ad42b56047f06c20326'/>
<id>urn:sha1:30035d9c66bc2a52352e3ad42b56047f06c20326</id>
<content type='text'>
map_refspec() either returns the passed in ref string or a detached
strbuf.  This makes it hard for callers to release the possibly
allocated memory, and set_refspecs() consequently leaks it.

Let map_refspec() append any refspecs directly and release its own
strbufs after use.  Rename it to refspec_append_mapped() and don't
return anything to reflect its increased responsibility.

set_refspecs() also leaks its strbufs.  Do the same here and directly
call refspec_append() in each if branch instead of holding onto a
detached strbuf, then dispose of the allocated memory after use.  We
need to add an else branch for the final call because all the other
conditional branches already add their formatted refspec now.

setup_push_upstream() and setup_push_current() forgot to release their
strbufs as well; plug these leaks, too, while at it.

None of these leaks were likely to impact users, because the number
and sizes of refspecs are usually small and the allocations are only
done once per program run.  Clean them up nevertheless, as another
step on the long road towards zero memory leaks.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'dl/push-recurse-submodules-fix'</title>
<updated>2020-05-05T21:54:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-05-05T21:54:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b75dc16ae3aa325941d64a3d0cfc1690a164786a'/>
<id>urn:sha1:b75dc16ae3aa325941d64a3d0cfc1690a164786a</id>
<content type='text'>
Code cleanup.

* dl/push-recurse-submodules-fix:
  push: unset PARSE_OPT_OPTARG for --recurse-submodules
</content>
</entry>
<entry>
<title>Merge branch 'dl/opt-callback-cleanup'</title>
<updated>2020-05-05T21:54:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-05-05T21:54:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=66527162008d2792c0000096dd7a41d6d5797df3'/>
<id>urn:sha1:66527162008d2792c0000096dd7a41d6d5797df3</id>
<content type='text'>
Code cleanup.

* dl/opt-callback-cleanup:
  Use OPT_CALLBACK and OPT_CALLBACK_F
</content>
</entry>
<entry>
<title>push: anonymize URLs in error messages and warnings</title>
<updated>2020-04-28T22:17:45Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-04-24T14:20:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d192fa50067d1630312a966aba22c90139812fc5'/>
<id>urn:sha1:d192fa50067d1630312a966aba22c90139812fc5</id>
<content type='text'>
Just like 47abd85ba0 (fetch: Strip usernames from url's before storing
them, 2009-04-17) and later 882d49ca5c (push: anonymize URL in status
output, 2016-07-13), and even later c1284b21f243 (curl: anonymize URLs
in error messages and warnings, 2019-03-04) this change anonymizes URLs
(read: strips them of user names and especially passwords) in
user-facing error messages and warnings.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Reviewed-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>push: unset PARSE_OPT_OPTARG for --recurse-submodules</title>
<updated>2020-04-28T17:47:42Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-04-27T06:44:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ce9baf234f04d2f1d183edbdc14e4ee9da46d895'/>
<id>urn:sha1:ce9baf234f04d2f1d183edbdc14e4ee9da46d895</id>
<content type='text'>
When the usage for `git push` is shown, it includes the following
lines

	--recurse-submodules[=(check|on-demand|no)]
			      control recursive pushing of submodules

which seem to indicate that the argument for --recurse-submodules is
optional. However, we cannot actually run that optiion without an
argument:

	$ git push --recurse-submodules
	fatal: recurse-submodules missing parameter

Unset PARSE_OPT_OPTARG so that it is clear that this option requires an
argument. Since the parse-options machinery guarantees that an argument
is present now, assume that `arg` is set in the else of
option_parse_recurse_submodules().

Reported-by: Andrew White &lt;andrew.white@audinate.com&gt;
Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Use OPT_CALLBACK and OPT_CALLBACK_F</title>
<updated>2020-04-28T17:47:10Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-04-28T08:36:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=203c85339fb51bb8b83aae8f0adde44d6e55e018'/>
<id>urn:sha1:203c85339fb51bb8b83aae8f0adde44d6e55e018</id>
<content type='text'>
In the codebase, there are many options which use OPTION_CALLBACK in a
plain ol' struct definition. However, we have the OPT_CALLBACK and
OPT_CALLBACK_F macros which are meant to abstract these plain struct
definitions away. These macros are useful as they semantically signal to
developers that these are just normal callback option with nothing fancy
happening.

Replace plain struct definitions of OPTION_CALLBACK with OPT_CALLBACK or
OPT_CALLBACK_F where applicable. The heavy lifting was done using the
following (disgusting) shell script:

	#!/bin/sh

	do_replacement () {
		tr '\n' '\r' |
			sed -e 's/{\s*OPTION_CALLBACK,\s*\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\s*0,\(\s*[^[:space:]}]*\)\s*}/OPT_CALLBACK(\1,\2,\3,\4,\5,\6)/g' |
			sed -e 's/{\s*OPTION_CALLBACK,\s*\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\(\s*[^[:space:]}]*\)\s*}/OPT_CALLBACK_F(\1,\2,\3,\4,\5,\6,\7)/g' |
			tr '\r' '\n'
	}

	for f in $(git ls-files \*.c)
	do
		do_replacement &lt;"$f" &gt;"$f.tmp"
		mv "$f.tmp" "$f"
	done

The result was manually inspected and then reformatted to match the
style of the surrounding code. Finally, using
`git grep OPTION_CALLBACK \*.c`, leftover results which were not handled
by the script were manually transformed.

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
