git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/3] Add hostname condition to includeIf

From
ICIsabella Caselli <bellacaselli20@gmail.com>
Date
Oct 15, 2026, 10:58 UTC
Message-ID
<20261015105859.3184108-1-bellacaselli20@gmail.com>
In-Reply-To
<20261012015846.2649843-1-bellacaselli20@gmail.com>

This series adds a "hostname:" condition to includeIf, allowing a configuration file to be included only on machines whose hostname matches a pattern. It also adds GIT_HOSTNAME to "git var", so users can see which hostname Git uses for matching.

Changes since v1 [1]:
 - Rewrite the commit message of patch 2 to explain what the test
   no longer verifies when the hostnames differ, as Junio asked.
[1] https://lore.kernel.org/git/20261012015846.2649843-1-bellacaselli20@gmail.com/
Isabella Caselli (3):
  var: add GIT_HOSTNAME
  t6500: get hostname from "git var"
  config: learn the "hostname:" includeIf condition
 Documentation/config.adoc  | 14 ++++++++++++
 Documentation/git-var.adoc |  5 +++++
 builtin/var.c              | 13 +++++++++++
 config.c                   | 17 +++++++++++++++
 t/t0007-git-var.sh         |  5 +++++
 t/t1305-config-include.sh  | 44 ++++++++++++++++++++++++++++++++++++++
 t/t6500-gc.sh              |  2 +-
 7 files changed, 99 insertions(+), 1 deletion(-)
Range-diff against v1:
1:  a34e1eb36f = 1:  7609601553 var: add GIT_HOSTNAME
2:  c341ae75c0 ! 2:  cb1599c7ce t6500: get hostname from "git var"
    @@ Commit message
         It gets the hostname from the "hostname" command, falling back to
         "unknown" if the command fails.
     
    -    "git gc" gets its hostname from the system and only checks whether the
    -    pid is alive if the two hostnames match. Otherwise, it assumes the
    -    lock belongs to a gc running on another machine. Since the test passes
    -    in either case, a missing "hostname" command or a mismatch between
    -    its output and the system hostname can cause the test to silently
    -    exercise the wrong case.
    +    "git gc" only checks whether the pid in "gc.pid" is alive if the
    +    recorded hostname matches its own. If the hostnames differ, it assumes
    +    the lock belongs to a gc running on another machine and skips the pid
    +    check. Since the test passes in either case, it may pass without
    +    checking whether "git gc" detects a running process on the same
    +    machine.
     
         Use "git var GIT_HOSTNAME" to get the same hostname as "git gc".
    -    Keep the "unknown" fallback, which is also used by "git gc" when it
    -    cannot determine the hostname.
    +    Keep the "unknown" fallback, which "git gc" also uses when it cannot
    +    determine the hostname.
     
         Helped-by: Jeff King <peff@peff.net>
         Signed-off-by: Isabella Caselli <bellacaselli20@gmail.com>
3:  a1e4fc5ba3 = 3:  5a2bb2172a config: learn the "hostname:" includeIf condition
base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
-- 
2.43.0
Previous: Jeff KingNext: Isabella Caselli
Message 16 of 20 in “hostname: includeIf condition — anyone already working on this?”
  1. Isabella CaselliSep 28, 2026
  2. Jeff KingSep 29, 2026
  3. Ignacio EncinasSep 29, 2026
  4. Jeff KingSep 29, 2026
  5. Junio C HamanoSep 29, 2026
  6. Isabella CaselliOct 2, 2026
  7. 0/3 Add hostname condition to includeIfIsabella Caselli, Oct 12, 2026
  8. 1/3 var: add GIT_HOSTNAMEIsabella Caselli, Oct 12, 2026
  9. 2/3 t6500: get hostname from "git var"Isabella Caselli, Oct 12, 2026
  10. Junio C HamanoOct 12, 2026
  11. Isabella CaselliOct 13, 2026
  12. Junio C HamanoOct 13, 2026
  13. 3/3 config: learn the "hostname:" includeIf conditionIsabella Caselli, Oct 12, 2026
  14. Junio C HamanoOct 12, 2026
  15. Jeff KingOct 14, 2026
  16. 0/3 Add hostname condition to includeIfIsabella Caselli, Oct 15, 2026
  17. 1/3 var: add GIT_HOSTNAMEIsabella Caselli, Oct 15, 2026
  18. Junio C HamanoOct 15, 2026
  19. 2/3 t6500: get hostname from "git var"Isabella Caselli, Oct 15, 2026
  20. 3/3 config: learn the "hostname:" includeIf conditionIsabella Caselli, Oct 15, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.