git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Karthik Nayak <karthik.188@gmail.com>
To: git@vger.kernel.org
Cc: phillip.wood@dunelm.org.uk, sunshine@sunshineco.com,
	Karthik Nayak <karthik.188@gmail.com>
Subject: [PATCH v7 0/2] check-attr: add support to work with tree-ish
Date: Sat, 14 Jan 2023 09:30:36 +0100	[thread overview]
Message-ID: <cover.1673684790.git.karthik.188@gmail.com> (raw)
In-Reply-To: <https://lore.kernel.org/git/cover.1673521102.git.karthik.188@gmail.com/>

v1: https://lore.kernel.org/git/20221206103736.53909-1-karthik.188@gmail.com/
v2: https://lore.kernel.org/git/CAOLa=ZSsFGBw3ta1jWN8cmUch2ca=zTEjp1xMA6Linafx9W53g@mail.gmail.com/T/#t
v3: https://lore.kernel.org/git/20221216093552.3171319-1-karthik.188@gmail.com/
v4: https://lore.kernel.org/git/cover.1671630304.git.karthik.188@gmail.com
v5: https://lore.kernel.org/git/cover.1671793109.git.karthik.188@gmail.com/
v6: https://lore.kernel.org/git/cover.1673521102.git.karthik.188@gmail.com/

Given a pathname, git-check-attr(1) will list the attributes which apply to that
pathname by reading all relevant gitattributes files. Currently there is no way
to specify a tree-ish to read the gitattributes from.

This is specifically useful in bare repositories wherein the gitattributes are
only present in the git working tree but not available directly on the
filesystem.

This series aims to add a new flag `--source` to git-check-attr(1) which
allows us to read gitattributes from the specified tree-ish.

Changes since v6:
- s/read_object_file/repo_read_object_file to make it more consistent
- In attr.h define 'struct object_id' instead of including 'hash.h' 

Range-diff against v5:

1:  6224754179 = 1:  6224754179 t0003: move setup for `--all` into new block
2:  57f5957127 ! 2:  0ca8b24589 attr: add flag `--source` to work with tree-ish
    @@ attr.c: static struct attr_stack *read_attr_from_file(const char *path, unsigned
     +	if (get_tree_entry(istate->repo, tree_oid, path, &oid, &mode))
     +		return NULL;
     +
    -+	buf = read_object_file(&oid, &type, &sz);
    ++	buf = repo_read_object_file(istate->repo, &oid, &type, &sz);
     +	if (!buf || type != OBJ_BLOB) {
     +		free(buf);
     +		return NULL;
    @@ attr.c: void git_check_attr(struct index_state *istate,
     
      ## attr.h ##
     @@
    - #ifndef ATTR_H
    - #define ATTR_H
    +  */
    + 
    + struct index_state;
    ++struct object_id;
      
    -+#include "hash.h"
    -+
      /**
    -  * gitattributes mechanism gives a uniform way to associate various attributes
    -  * to set of paths.
    +  * An attribute is an opaque object that is identified by its name. Pass the
     @@ attr.h: void attr_check_free(struct attr_check *check);
      const char *git_attr_name(const struct git_attr *);
      


Karthik Nayak (2):
  t0003: move setup for `--all` into new block
  attr: add flag `--source` to work with tree-ish

 Documentation/git-check-attr.txt |  9 ++-
 archive.c                        |  2 +-
 attr.c                           | 97 +++++++++++++++++++++++---------
 attr.h                           |  6 +-
 builtin/check-attr.c             | 35 +++++++-----
 builtin/pack-objects.c           |  2 +-
 convert.c                        |  2 +-
 ll-merge.c                       |  4 +-
 pathspec.c                       |  2 +-
 t/t0003-attributes.sh            | 48 +++++++++++++++-
 userdiff.c                       |  2 +-
 ws.c                             |  2 +-
 12 files changed, 156 insertions(+), 55 deletions(-)

-- 
2.39.0


       reply	other threads:[~2023-01-14  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <https://lore.kernel.org/git/cover.1673521102.git.karthik.188@gmail.com/>
2023-01-14  8:30 ` Karthik Nayak [this message]
2023-01-14  8:30   ` [PATCH v7 1/2] t0003: move setup for `--all` into new block Karthik Nayak
2023-01-14  8:30   ` [PATCH v7 2/2] attr: add flag `--source` to work with tree-ish Karthik Nayak

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1673684790.git.karthik.188@gmail.com \
    --to=karthik.188@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sunshine@sunshineco.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).