From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jonas Rebmann <jre@pengutronix.de>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH] scripts: add helper for generating Origin-URL references
Date: Thu, 18 Dec 2025 09:04:29 +0100 [thread overview]
Message-ID: <aUO1jd7LuiAfKDNG@pengutronix.de> (raw)
In-Reply-To: <efca75a6-a218-48ee-8471-2e2967e86de5@pengutronix.de>
On Wed, Dec 17, 2025 at 11:59:43AM +0100, Jonas Rebmann wrote:
> > +# Optional second argument to allow e.g. !git origin-url $remote_file % im vim
> > +# In cases where local file has different extension then the original
> > +dstbasename="$(basename ${2:-$1})"
> > +
> > +[ -e "$1" ] || err "File not found"
> > +
> > +filepath="$(realpath "$1")"
> > +
> > +repo_root="$(git -C "$(dirname "$filepath")" rev-parse --show-toplevel 2>/dev/null \
> > + || err "Not inside a Git repository: $filepath")"
> > +
> > +rel_path="$(realpath --relative-to="$repo_root" "$filepath")"
> > +
> > +# newest commit that touched this file
> > +file_commit="$(git -C "$repo_root" log -n1 --format=%H -- "$rel_path")"
>
> So the idea is that the Origin-URL is generated for the commit to which
> <path-to-file> is checked out at the time? Maybe you could state that
> more clearly e.g. in the top of the script or in the usage message.
>
> We don't want people to add Origin-URLs referencing just any commit.
Ah, should have read that before writing a mail ;)
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-12-18 8:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 10:35 Ahmad Fatoum
2025-12-17 10:59 ` Jonas Rebmann
2025-12-18 8:04 ` Sascha Hauer [this message]
2025-12-18 8:01 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aUO1jd7LuiAfKDNG@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jre@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox