All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hariom Verma via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Hariom Verma <hariom18599@gmail.com>
Subject: [PATCH v4 0/8] [GSoC] Improvements to ref-filter
Date: Fri, 21 Aug 2020 21:41:42 +0000	[thread overview]
Message-ID: <pull.684.v4.git.1598046110.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.684.v3.git.1597687822.gitgitgadget@gmail.com>

This is the first patch series that introduces some improvements and
features to file ref-filter.{c,h}. These changes are useful to ref-filter,
but in near future also will allow us to use ref-filter's logic in pretty.c

I plan to add more to format-support.{c,h} in the upcoming patch series.
That will lead to more improved and feature-rich ref-filter.c

Hariom Verma (8):
  ref-filter: support different email formats
  ref-filter: refactor `grab_objectname()`
  ref-filter: modify error messages in `grab_objectname()`
  ref-filter: rename `objectname` related functions and fields
  ref-filter: add `short` modifier to 'tree' atom
  ref-filter: add `short` modifier to 'parent' atom
  pretty: refactor `format_sanitized_subject()`
  ref-filter: add `sanitize` option for 'subject' atom

 Documentation/git-for-each-ref.txt |  10 +-
 pretty.c                           |  20 ++--
 pretty.h                           |   3 +
 ref-filter.c                       | 158 +++++++++++++++++++----------
 t/t6300-for-each-ref.sh            |  35 +++++++
 5 files changed, 161 insertions(+), 65 deletions(-)


base-commit: 675a4aaf3b226c0089108221b96559e0baae5de9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-684%2Fharry-hov%2Fonly-rf6-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-684/harry-hov/only-rf6-v4
Pull-Request: https://github.com/gitgitgadget/git/pull/684

Range-diff vs v3:

  1:  3e6fc66a46 =  1:  55618fe4c1 ref-filter: support different email formats
  2:  5268b973da =  2:  c508c96eb8 ref-filter: refactor `grab_objectname()`
  3:  4a12ff8210 =  3:  582f00ace6 ref-filter: modify error messages in `grab_objectname()`
  4:  d53ca56778 =  4:  503a1874ce ref-filter: rename `objectname` related functions and fields
  5:  fd4ed82e80 =  5:  6b97166796 ref-filter: add `short` modifier to 'tree' atom
  6:  7a039823de =  6:  5ed5ac259d ref-filter: add `short` modifier to 'parent' atom
  7:  0ad22c7cdd !  7:  6105046d96 pretty: refactor `format_sanitized_subject()`
     @@ Commit message
          of `\n` in a variable `eol` and passed it in
          `format_sanitized_subject()`. And the loop runs upto `eol`.
      
     -    But this change isn't sufficient to reuse this function in
     -    ref-filter.c because there exist tags with multiline subject.
     -
     -    It's wise to replace `\n` with ' ', if `format_sanitized_subject()`
     -    encounters `\n` before end of subject line, just like `copy_subject()`.
     -    Because we'll be only using `format_sanitized_subject()` for
     -    "%(subject:sanitize)", instead of `copy_subject()` and
     -    `format_sanitized_subject()` both. So, added the code:
     -    ```
     -    if (char == '\n') /* never true if called inside pretty.c */
     -        char = ' ';
     -    ```
     -
     -    Now, it's ready to be reused in ref-filter.c
     -
          Mentored-by: Christian Couder <chriscool@tuxfamily.org>
          Mentored-by: Heba Waly <heba.waly@gmail.com>
          Signed-off-by: Hariom Verma <hariom18599@gmail.com>
     @@ pretty.c: static int istitlechar(char c)
       }
       
      -static void format_sanitized_subject(struct strbuf *sb, const char *msg)
     -+static void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len)
     ++void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len)
       {
     -+	char *r = xmemdupz(msg, len);
       	size_t trimlen;
       	size_t start_len = sb->len;
       	int space = 2;
     @@ pretty.c: static int istitlechar(char c)
      -	for (; *msg && *msg != '\n'; msg++) {
      -		if (istitlechar(*msg)) {
      +	for (i = 0; i < len; i++) {
     -+		if (r[i] == '\n')
     -+			r[i] = ' ';
     -+		if (istitlechar(r[i])) {
     ++		if (istitlechar(msg[i])) {
       			if (space == 1)
       				strbuf_addch(sb, '-');
       			space = 0;
     @@ pretty.c: static int istitlechar(char c)
      -			if (*msg == '.')
      -				while (*(msg+1) == '.')
      -					msg++;
     -+			strbuf_addch(sb, r[i]);
     -+			if (r[i] == '.')
     -+				while (r[i+1] == '.')
     ++			strbuf_addch(sb, msg[i]);
     ++			if (msg[i] == '.')
     ++				while (msg[i+1] == '.')
      +					i++;
       		} else
       			space |= 1;
       	}
     -+	free(r);
     - 
     - 	/* trim any trailing '.' or '-' characters */
     - 	trimlen = 0;
      @@ pretty.c: static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
       	const struct commit *commit = c->commit;
       	const char *msg = c->message;
     @@ pretty.c: static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
       		return 1;
       	case 'b':	/* body */
       		strbuf_addstr(sb, msg + c->body_off);
     +
     + ## pretty.h ##
     +@@ pretty.h: const char *format_subject(struct strbuf *sb, const char *msg,
     + /* Check if "cmit_fmt" will produce an empty output. */
     + int commit_format_is_empty(enum cmit_fmt);
     + 
     ++/* Make subject of commit message suitable for filename */
     ++void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len);
     ++
     + #endif /* PRETTY_H */
  8:  7a64495f99 <  -:  ---------- format-support: move `format_sanitized_subject()` from pretty
  9:  1ab35e9251 !  8:  7cba8d7a28 ref-filter: add `sanitize` option for 'subject' atom
     @@ Documentation/git-for-each-ref.txt: contents:subject::
       	The remainder of the commit or the tag message that follows
      
       ## ref-filter.c ##
     -@@
     - #include "worktree.h"
     - #include "hashmap.h"
     - #include "strvec.h"
     -+#include "format-support.h"
     - 
     - static struct ref_msg {
     - 	const char *gone;
      @@ ref-filter.c: static struct used_atom {
       			unsigned int nobracket : 1, push : 1, push_remote : 1;
       		} remote_ref;

-- 
gitgitgadget

  parent reply	other threads:[~2020-08-21 21:41 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 20:43 [PATCH 0/5] [GSoC] Improvements to ref-filter Hariom Verma via GitGitGadget
2020-07-27 20:43 ` [PATCH 1/5] ref-filter: support different email formats Hariom Verma via GitGitGadget
2020-07-27 22:51   ` Junio C Hamano
2020-07-28 20:31     ` Hariom verma
2020-07-28 20:43       ` Junio C Hamano
2020-07-28 13:58   ` Đoàn Trần Công Danh
2020-07-28 16:45     ` Junio C Hamano
2020-07-27 20:43 ` [PATCH 2/5] ref-filter: add `short` option for 'tree' and 'parent' Hariom Verma via GitGitGadget
2020-07-27 23:21   ` Junio C Hamano
2020-07-27 20:43 ` [PATCH 3/5] pretty: refactor `format_sanitized_subject()` Hariom Verma via GitGitGadget
2020-07-27 20:43 ` [PATCH 4/5] format-support: move `format_sanitized_subject()` from pretty Hariom Verma via GitGitGadget
2020-07-27 20:43 ` [PATCH 5/5] ref-filter: add `sanitize` option for 'subject' atom Hariom Verma via GitGitGadget
2020-08-05 21:51 ` [PATCH v2 0/9] [GSoC] Improvements to ref-filter Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 1/9] ref-filter: support different email formats Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 2/9] ref-filter: refactor `grab_objectname()` Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 3/9] ref-filter: modify error messages in `grab_objectname()` Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 4/9] ref-filter: rename `objectname` related functions and fields Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 5/9] ref-filter: add `short` modifier to 'tree' atom Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 6/9] ref-filter: add `short` modifier to 'parent' atom Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 7/9] pretty: refactor `format_sanitized_subject()` Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 8/9] format-support: move `format_sanitized_subject()` from pretty Hariom Verma via GitGitGadget
2020-08-05 21:51   ` [PATCH v2 9/9] ref-filter: add `sanitize` option for 'subject' atom Hariom Verma via GitGitGadget
2020-08-05 22:04   ` [PATCH v2 0/9] [GSoC] Improvements to ref-filter Junio C Hamano
2020-08-06 13:47     ` Hariom verma
2020-08-17 18:10   ` [PATCH v3 0/9] [Resend][GSoC] " Hariom Verma via GitGitGadget
2020-08-17 18:10     ` [PATCH v3 1/9] ref-filter: support different email formats Hariom Verma via GitGitGadget
2020-08-17 18:10     ` [PATCH v3 2/9] ref-filter: refactor `grab_objectname()` Hariom Verma via GitGitGadget
2020-08-17 18:10     ` [PATCH v3 3/9] ref-filter: modify error messages in `grab_objectname()` Hariom Verma via GitGitGadget
2020-08-17 18:10     ` [PATCH v3 4/9] ref-filter: rename `objectname` related functions and fields Hariom Verma via GitGitGadget
2020-08-17 18:10     ` [PATCH v3 5/9] ref-filter: add `short` modifier to 'tree' atom Hariom Verma via GitGitGadget
2020-08-17 18:10     ` [PATCH v3 6/9] ref-filter: add `short` modifier to 'parent' atom Hariom Verma via GitGitGadget
2020-08-17 18:10     ` [PATCH v3 7/9] pretty: refactor `format_sanitized_subject()` Hariom Verma via GitGitGadget
2020-08-17 19:29       ` Junio C Hamano
2020-08-19 13:36         ` Hariom verma
2020-08-19 16:01           ` Junio C Hamano
2020-08-19 16:08             ` Junio C Hamano
2020-08-20 17:33               ` Hariom verma
2020-08-20 17:27             ` Hariom verma
2020-08-17 18:10     ` [PATCH v3 8/9] format-support: move `format_sanitized_subject()` from pretty Hariom Verma via GitGitGadget
2020-08-17 19:33       ` Junio C Hamano
2020-08-17 18:10     ` [PATCH v3 9/9] ref-filter: add `sanitize` option for 'subject' atom Hariom Verma via GitGitGadget
2020-08-17 19:37     ` [PATCH v3 0/9] [Resend][GSoC] Improvements to ref-filter Junio C Hamano
2020-08-21 21:41     ` Hariom Verma via GitGitGadget [this message]
2020-08-21 21:41       ` [PATCH v4 1/8] ref-filter: support different email formats Hariom Verma via GitGitGadget
2020-08-21 21:41       ` [PATCH v4 2/8] ref-filter: refactor `grab_objectname()` Hariom Verma via GitGitGadget
2020-08-21 21:41       ` [PATCH v4 3/8] ref-filter: modify error messages in `grab_objectname()` Hariom Verma via GitGitGadget
2020-08-21 21:41       ` [PATCH v4 4/8] ref-filter: rename `objectname` related functions and fields Hariom Verma via GitGitGadget
2020-08-21 21:41       ` [PATCH v4 5/8] ref-filter: add `short` modifier to 'tree' atom Hariom Verma via GitGitGadget
2020-08-21 21:41       ` [PATCH v4 6/8] ref-filter: add `short` modifier to 'parent' atom Hariom Verma via GitGitGadget
2020-08-21 21:41       ` [PATCH v4 7/8] pretty: refactor `format_sanitized_subject()` Hariom Verma via GitGitGadget
2020-08-21 21:41       ` [PATCH v4 8/8] ref-filter: add `sanitize` option for 'subject' atom Hariom Verma via GitGitGadget

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=pull.684.v4.git.1598046110.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hariom18599@gmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.