0

When I check out for example the git repository https://github.com/rust-lang/stdarch.git (taken at random from github) and then do

git diff eaee02ffdf5d820729ccdf2f95fa08b08c7d24d2^ eaee02ffdf5d820729ccdf2f95fa08b08c7d24d2 

to view a commit, I get something starting with

diff --git a/crates/core_arch/src/core_arch_docs.md b/crates/core_arch/src/core_arch_docs.md index 58b7eda9..eddd1fc0 100644 --- a/crates/core_arch/src/core_arch_docs.md +++ b/crates/core_arch/src/core_arch_docs.md @@ -194,18 +194,18 @@ others at: * [`nvptx`] * [`wasm32`] -[`x86`]: x86/index.html -[`x86_64`]: x86_64/index.html -[`arm`]: arm/index.html -[`aarch64`]: aarch64/index.html -[`riscv32`]: riscv32/index.html -[`riscv64`]: riscv64/index.html -[`mips`]: mips/index.html -[`mips64`]: mips64/index.html -[`powerpc`]: powerpc/index.html -[`powerpc64`]: powerpc64/index.html -[`nvptx`]: nvptx/index.html -[`wasm32`]: wasm32/index.html +[`x86`]: ../../core/arch/x86/index.html +[`x86_64`]: ../../core/arch/x86_64/index.html +[`arm`]: ../../core/arch/arm/index.html +[`aarch64`]: ../../core/arch/aarch64/index.html 

I'm wondering about the text after the second @@ in the fifth line (in this case others at:). From other examples I had the impression that most of the time it's the line immediately preceding the quoted text block, but in this specific case, looking at the file shows us that it's not the line immediately preceding the block, in fact 14 lines further up.

What's the point of the text after the @@ in general? Is it maybe to have something easily fulltext-searchable in a large file? Is it maybe documented somewhere?

6
  • 1
    I think it's specific to whatever program git diff uses to generate the diff. git help diff only documents what the number of @ bracketing the chunk header means; it doesn't say anything about text following it. Commented Feb 9, 2022 at 22:01
  • 1
    "The optional header shows the C function where each change occurs, if it is a C file, … or the equivalent, if any, for other types of files." Commented Feb 9, 2022 at 22:10
  • @phd thanks for your answer. I wouldn't have minded some more details if the question hadn't been closed ... Commented Feb 9, 2022 at 22:21
  • 1
    There is documentation for how to tell Git how to create the text-after-@@. It is buried in the gitattributes documentation; search for "custom hunk-header". Commented Feb 10, 2022 at 0:13
  • Thanks @torek! Now that I know that it's called "hunk header", it's easier to google for more info Commented Feb 10, 2022 at 0:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.